本文整理汇总了C++中QDockWidget::installEventFilter方法的典型用法代码示例。如果您正苦于以下问题:C++ QDockWidget::installEventFilter方法的具体用法?C++ QDockWidget::installEventFilter怎么用?C++ QDockWidget::installEventFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDockWidget
的用法示例。
在下文中一共展示了QDockWidget::installEventFilter方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addDockForWidget
/*!
Keep track of dock widgets so they can be shown/hidden for different languages
*/
QDockWidget *DebuggerMainWindow::createDockWidget(const DebuggerLanguage &language,
QWidget *widget)
{
QDockWidget *dockWidget = addDockForWidget(widget);
dockWidget->setObjectName(widget->objectName());
addDockWidget(Qt::BottomDockWidgetArea, dockWidget);
if (!(d->m_activeDebugLanguages & language))
dockWidget->hide();
QAction *toggleViewAction = dockWidget->toggleViewAction();
Command *cmd = ActionManager::registerAction(toggleViewAction,
Id("Debugger.").withSuffix(widget->objectName()));
cmd->setAttribute(Command::CA_Hide);
dockWidget->installEventFilter(&d->m_resizeEventFilter);
connect(dockWidget->toggleViewAction(), &QAction::triggered,
d, &DebuggerMainWindowPrivate::updateDockWidgetSettings);
connect(dockWidget, &QDockWidget::topLevelChanged,
d, &DebuggerMainWindowPrivate::updateDockWidgetSettings);
connect(dockWidget, &QDockWidget::dockLocationChanged,
d, &DebuggerMainWindowPrivate::updateDockWidgetSettings);
return dockWidget;
}
示例2: createDockWindows
void MainWindow::createDockWindows()
{
m_wInputMonitor = new FrameMonitor(this);
m_wInputMonitorDock = new QDockWidget(tr("Input monitor"), this);
m_wInputMonitorDock->setWidget(m_wInputMonitor);
m_wInputMonitorDock->setObjectName("inputMonitor");
addDockWidget(Qt::TopDockWidgetArea, m_wInputMonitorDock);
m_wCurveMonitor = new FrameMonitor(this);
m_wCurveMonitorDock = new QDockWidget(tr("Curve monitor"), this);
m_wCurveMonitorDock->setWidget(m_wCurveMonitor);
m_wCurveMonitorDock->setObjectName("curveMonitor");
addDockWidget(Qt::TopDockWidgetArea, m_wCurveMonitorDock);
m_wRenderPreview = new RenderPreview(m_project, this);
m_wRenderPreviewDock = new QDockWidget(tr("Render preview"), this);
m_wRenderPreviewDock->setWidget(m_wRenderPreview);
m_wRenderPreviewDock->setObjectName("renderPreview");
addDockWidget(Qt::TopDockWidgetArea, m_wRenderPreviewDock);
//TODO: replace by :
// ui->menuView->addAction(dock->toggleViewAction());
// http://ariya.ofilabs.com/2007/04/custom-toggle-action-for-qdockwidget.html
// Fill the view menu that allows (de)activating widgets
QObjectList windowChildren = children();
QDockWidget *w;
for (int i = 0; i < windowChildren.size(); i++) {
if ((w = dynamic_cast<QDockWidget*>(windowChildren.at(i))) != NULL) {
qDebug() << "Adding " << w->windowTitle() << " to the menu's widget list";
QAction *a = new QAction("&" + w->objectName(), this);
a->setCheckable(true);
connect(a, SIGNAL(toggled(bool)), w, SLOT(setVisible(bool)));
// This does not work since it is also emitted e.g. when the window is minimized
// (with «Show Desktop» on KDE4), therefore an event filter is required. (below.)
// Thanks ArGGu^^ for the tip!
connect(w, SIGNAL(visibilityChanged(bool)), a, SLOT(setChecked(bool)));
//a->setChecked(true);
#if QT_VERSION <= QT_VERSION_CHECK(4, 2, 0)
// To uncheck the menu entry when the widget is closed via the (x)
w->installEventFilter(this);
#endif
ui->menuView->addAction(a);
m_widgetActions << a;
}
}
}
示例3: createDock
QDockWidget* DockHost::createDock(QWidget* parent, QWidget* widget, const QString &title)
{
static int counter = 0;
QDockWidget* dock = new QDockWidget(parent);
dock->setObjectName(QString("dock%1").arg(++counter));
dock->setWidget(widget);
dock->setWindowTitle(title);
QObject::connect(dock, &QDockWidget::topLevelChanged, this, &DockHost::onDockTopLevelChanged);
QObject::connect(dock, &QDockWidget::visibilityChanged, this, &DockHost::onDockVisibilityChanged);
QObject::connect(dock, &QDockWidget::featuresChanged, this, &DockHost::onDockFeaturesChanged);
QAction* action = dock->toggleViewAction();
action->disconnect();
QObject::connect(action, &QAction::triggered, this, &DockHost::onDockActionTriggered);
dock->installEventFilter(this);
widgets << widget;
return dock;
}
示例4: DockWidgetVolume
/**
* @brief
* Constructor
*/
DockWidgetVolumeTransferFunction::DockWidgetVolumeTransferFunction(QMainWindow *pQMainWindow, DockWidgetManager *pDockWidgetManager) : DockWidgetVolume(reinterpret_cast<QWidget*>(pQMainWindow), pDockWidgetManager),
m_pDockWidgetVolumeTransferFunctionQObject(new DockWidgetVolumeTransferFunctionQObject(*this)),
m_pTransferFunctionWidget(nullptr),
m_pTransferFunctionResultWidget(nullptr)
{
// Get encapsulated Qt dock widget
QDockWidget *pQDockWidget = GetQDockWidget();
if (pQDockWidget) {
// Set window title
pQDockWidget->setWindowTitle(pQDockWidget->tr(GetClass()->GetProperties().Get("Title")));
// Add the created Qt dock widget to the given Qt main window and tabify it for better usability
AddDockWidgetAndTabify(*pQMainWindow, Qt::LeftDockWidgetArea, *pQDockWidget);
// The Qt object should receive events from the encapsulated Qt dock widget
pQDockWidget->installEventFilter(m_pDockWidgetVolumeTransferFunctionQObject);
// Update the volume information
UpdateObject(GetSelectedObject());
}
}
示例5: createDock
QDockWidget* DockHost::createDock(QWidget* parent, QWidget* widget, const QString& title)
{
static int counter = 0;
QDockWidget* dock = new QDockWidget(parent);
dock->setObjectName(QString("dock%1").arg(++counter));
QMargins widgetMargins = widget->layout()->contentsMargins();
widgetMargins.setTop(widgetMargins.top() + 2);
widget->layout()->setContentsMargins(widgetMargins);
dock->setWidget(widget);
dock->setWindowTitle(title);
QObject::connect(dock, &QDockWidget::topLevelChanged, this, &DockHost::onDockTopLevelChanged);
QAction* action = dock->toggleViewAction();
action->disconnect();
QObject::connect(action, &QAction::triggered, this, &DockHost::onDockActionTriggered);
dock->installEventFilter(this);
widgets << widget;
return dock;
}
示例6: QMainWindow
MainWindow::MainWindow(QString projectPath, QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
m_progressDialog(NULL),
m_renderProgressDialog(NULL),
m_flowExaminer(NULL),
m_cs(this)
{
ui->setupUi(this);
restoreGeometry(m_settings.value("geometry").toByteArray());
restoreState(m_settings.value("windowState").toByteArray());
m_project = new Project_sV();
m_wCanvas = new Canvas(m_project, this);
setCentralWidget(m_wCanvas);
m_wInputMonitor = new FrameMonitor(this);
m_wInputMonitorDock = new QDockWidget(tr("Input monitor"), this);
m_wInputMonitorDock->setWidget(m_wInputMonitor);
m_wInputMonitorDock->setObjectName("inputMonitor");
addDockWidget(Qt::TopDockWidgetArea, m_wInputMonitorDock);
m_wCurveMonitor = new FrameMonitor(this);
m_wCurveMonitorDock = new QDockWidget(tr("Curve monitor"), this);
m_wCurveMonitorDock->setWidget(m_wCurveMonitor);
m_wCurveMonitorDock->setObjectName("curveMonitor");
addDockWidget(Qt::TopDockWidgetArea, m_wCurveMonitorDock);
m_wRenderPreview = new RenderPreview(m_project, this);
m_wRenderPreviewDock = new QDockWidget(tr("Render preview"), this);
m_wRenderPreviewDock->setWidget(m_wRenderPreview);
m_wRenderPreviewDock->setObjectName("renderPreview");
addDockWidget(Qt::TopDockWidgetArea, m_wRenderPreviewDock);
// Fill the view menu that allows (de)activating widgets
QObjectList windowChildren = children();
QDockWidget *w;
for (int i = 0; i < windowChildren.size(); i++) {
if ((w = dynamic_cast<QDockWidget*>(windowChildren.at(i))) != NULL) {
qDebug() << "Adding " << w->windowTitle() << " to the menu's widget list";
QAction *a = new QAction("&" + w->objectName(), this);
a->setCheckable(true);
bool b = true;
b &= connect(a, SIGNAL(toggled(bool)), w, SLOT(setVisible(bool)));
// This does not work since it is also emitted e.g. when the window is minimized
// (with «Show Desktop» on KDE4), therefore an event filter is required. (below.)
// Thanks ArGGu^^ for the tip!
// b &= connect(w, SIGNAL(visibilityChanged(bool)), a, SLOT(setChecked(bool)));
Q_ASSERT(b);
a->setChecked(true);
// To uncheck the menu entry when the widget is closed via the (x)
w->installEventFilter(this);
ui->menuView->addAction(a);
m_widgetActions << a;
}
}