当前位置: 首页>>代码示例>>C++>>正文


C++ QDockWidget::objectName方法代码示例

本文整理汇总了C++中QDockWidget::objectName方法的典型用法代码示例。如果您正苦于以下问题:C++ QDockWidget::objectName方法的具体用法?C++ QDockWidget::objectName怎么用?C++ QDockWidget::objectName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QDockWidget的用法示例。


在下文中一共展示了QDockWidget::objectName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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;
            
        }
    }
}
开发者ID:Ichthyostega,项目名称:slowmoVideo,代码行数:50,代码来源:mainwindow.cpp

示例2: eventFilter

/**
 * this is only for pre 4.2 code !
 * http://ariya.ofilabs.com/2007/04/custom-toggle-action-for-qdockwidget.html
 */
bool MainWindow::eventFilter(QObject *obj, QEvent *e)
{

    
    QObjectList windowChildren = children();
    QDockWidget *w;
    
    if (e->type() == QEvent::Close && windowChildren.contains(obj)) {
        if ((w = dynamic_cast<QDockWidget *>(obj)) != NULL) {
            
            QList<QAction*> actions = findChildren<QAction *>();
            for (int i = 0; i < actions.size(); i++) {
                if (actions.at(i)->text() == w->objectName()) {
                    actions.at(i)->setChecked(false);
                    return true;
                }
            }
            
        }
    }

    return QObject::eventFilter(object, event);
    //return false;
}
开发者ID:Ichthyostega,项目名称:slowmoVideo,代码行数:28,代码来源:mainwindow.cpp

示例3: setupUi


//.........这里部分代码省略.........
    searchTable->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
    searchTable->verticalHeader()->setVisible(false);
    //searchTable->horizontalHeader()->setVisible(false);
    searchTable->horizontalHeader()->setHighlightSections(false);
    searchTable->horizontalHeader()->setStretchLastSection(true);
    connect(searchTable, SIGNAL(currentCellChanged(int,int,int,int)), this, SLOT(currentRowColumnChanged(int,int,int,int)));

    //install delagate on third column
    SaagharItemDelegate* searchDelegate = new SaagharItemDelegate(searchTable, searchTable->style(), phrase);
    searchTable->setItemDelegateForColumn(2, searchDelegate);
    connect(this, SIGNAL(searchFiltered(QString)), searchDelegate, SLOT(keywordChanged(QString)));

    //searchTable->setItemDelegateForColumn(2, new SaagharItemDelegate(searchTable, searchTable->style(), phrase));

    searchTableGridLayout->addWidget(searchTable, 0, 0, 1, 1);

//  QVBoxLayout *searchNavVerticalLayout = new QVBoxLayout();
//  searchNavVerticalLayout->setSpacing(6);
//  searchNavVerticalLayout->setObjectName(QString::fromUtf8("searchNavVerticalLayout"));

    searchNextPage = new QToolButton(searchResultContents);
    searchNextPage->setObjectName(QString::fromUtf8("searchNextPage"));
    searchNextPage->setStyleSheet("QToolButton { border: none; padding: 0px; }");

    actSearchNextPage = new QAction(searchResultContents);
    searchNextPage->setDefaultAction(actSearchNextPage);

    connect(searchNextPage, SIGNAL(triggered(QAction*)), this, SLOT(searchPageNavigationClicked(QAction*)));

    searchNextPage->setEnabled(false);
    searchNextPage->hide();

    //searchNavVerticalLayout->addWidget(searchNextPage);

    searchPreviousPage = new QToolButton(searchResultContents);
    searchPreviousPage->setObjectName(QString::fromUtf8("searchPreviousPage"));
    searchPreviousPage->setStyleSheet("QToolButton { border: none; padding: 0px; }");

    actSearchPreviousPage = new QAction(searchResultContents);
    searchPreviousPage->setDefaultAction(actSearchPreviousPage);

    if (qmw->layoutDirection() == Qt::LeftToRight) {
        actSearchPreviousPage->setIcon(QIcon(iconThemePath + "/previous.png"));
        actSearchNextPage->setIcon(QIcon(iconThemePath + "/next.png"));
    }
    else {
        actSearchPreviousPage->setIcon(QIcon(iconThemePath + "/next.png"));
        actSearchNextPage->setIcon(QIcon(iconThemePath + "/previous.png"));
    }

    connect(searchPreviousPage, SIGNAL(triggered(QAction*)), this, SLOT(searchPageNavigationClicked(QAction*)));

    searchPreviousPage->setEnabled(false);
    searchPreviousPage->hide();

//  searchNavVerticalLayout->addWidget(searchPreviousPage);

    //QSpacerItem *searchNavVerticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);

    //searchNavVerticalLayout->addItem(searchNavVerticalSpacer);

//  if (moreThanOnePage)
//      horizontalLayout->addLayout(searchNavVerticalLayout);

    filterHorizontalLayout->addWidget(searchPreviousPage);
    filterHorizontalLayout->addWidget(searchNextPage);
    filterHorizontalLayout->addWidget(pageLabel, 0, Qt::AlignRight | Qt::AlignCenter);
    searchTableGridLayout->addLayout(filterHorizontalLayout, 1, 0, 1, 1);

    horizontalLayout->addLayout(searchTableGridLayout);

    searchGridLayout->addLayout(horizontalLayout, 0, 0, 1, 1);

    /****************************/
    QDockWidget* tmpDockWidget = 0;
    QObjectList mainWindowChildren = qmw->children();
    for (int i = 0; i < mainWindowChildren.size(); ++i) {
        tmpDockWidget = qobject_cast<QDockWidget*>(mainWindowChildren.at(i));
        if (tmpDockWidget) {
            if (mainWindowChildren.at(i)->objectName() == "searchResultWidget_old") {
                break;
            }
        }
    }

    /****************************************/
    searchResultWidget->setWidget(searchResultContents);

    qmw->addDockWidget(Qt::BottomDockWidgetArea, searchResultWidget);

    if (tmpDockWidget && tmpDockWidget->objectName() == "searchResultWidget_old") { //there is another search results dock-widget present
        qmw->tabifyDockWidget(tmpDockWidget, searchResultWidget);
    }


    searchResultWidget->setObjectName("searchResultWidget_old");

    searchResultWidget->show();
    searchResultWidget->raise();
}
开发者ID:mkhoeini,项目名称:Saaghar,代码行数:101,代码来源:searchresultwidget.cpp

示例4: 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;

        }
    }
开发者ID:Tungee,项目名称:slowmoVideo,代码行数:63,代码来源:mainwindow.cpp


注:本文中的QDockWidget::objectName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。