QWidget标题栏双击事件

  1. virtual bool event(QEvent * event);
  2. bool Widget::event(QEvent *event)
  3. {
  4. if(event->type() == QEvent::NonClientAreaMouseButtonDblClick){
  5. qDebug() << "title double clicked event";
  6. }
  7. return QWidget::event(event);
  8. }

QWidget界面设置成模态框

  1. // 设置窗体模态,要求该窗体没有父类,否则无效
  2. widget->setWindowModality(Qt::ApplicationModal);