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


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

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


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

示例1: createDockWindows

void MainWindow::createDockWindows()
{
    QDockWidget *dock = new QDockWidget(tr("Text Editor"), this);
    m_editor = new TextEdit(dock);
    connect(m_editor->document(), SIGNAL(contentsChanged()), this, SLOT(onEditorChanged()));
    dock->setWidget(m_editor);
    dock->setObjectName("text_editor");
    addDockWidget(Qt::RightDockWidgetArea, dock);

    m_showEditorDockAction = dock->toggleViewAction();
    m_showEditorDockAction->setIconVisibleInMenu(false);
    m_showEditorDockAction->setStatusTip(tr("Show or hide the document editor dock"));
    m_showEditorDockAction->setIcon(QIcon::fromTheme("accessories-text-editor"));
    m_showEditorDockAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_0));

    dock = new QDockWidget(tr("Assistant"), this);
    m_assistantToolBox = new QToolBox(dock);
    dock->setWidget(m_assistantToolBox);
    dock->setObjectName("assistant");
    addDockWidget(Qt::LeftDockWidgetArea, dock);
    connect(m_assistantToolBox, SIGNAL(currentChanged(int)),
            this, SLOT(onCurrentAssistantChanged(int)));

    m_showAssistantDockAction = dock->toggleViewAction();
    m_showAssistantDockAction->setIconVisibleInMenu(false);
    m_showAssistantDockAction->setStatusTip(tr("Show or hide the assistant dock"));
#if !defined(Q_WS_WIN) // BUG: icons are not displayed when cross-linking
    m_showAssistantDockAction->setIcon(QIcon(":/assistant.svg"));
#endif
    m_showAssistantDockAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_1));

    dock = new QDockWidget(tr("Assistant Info"), this);
    QWidget* widget = new QWidget(dock);
    m_assistantPreviewNotes = new QLabel(widget);
    m_assistantPreviewNotes->setText(tr("Code:"));
    m_assistantCodePreview = new QTextEdit(widget);
    m_assistantCodePreview->setReadOnly(true);
    QBoxLayout* assistant_info_layout = new QBoxLayout(QBoxLayout::TopToBottom, widget);
    assistant_info_layout->addWidget(m_assistantPreviewNotes);
    assistant_info_layout->addWidget(m_assistantCodePreview);
    widget->setLayout(assistant_info_layout);
    dock->setWidget(widget);
    dock->setObjectName("assistant_info");
    addDockWidget(Qt::LeftDockWidgetArea, dock);

    m_showAssistantInfoDockAction = dock->toggleViewAction();
    m_showAssistantInfoDockAction->setIconVisibleInMenu(false);
    m_showAssistantInfoDockAction->setStatusTip(tr("Show or hide the assistant info dock"));
#if !defined(Q_WS_WIN) // BUG: icons are not displayed when cross-linking
    m_showAssistantInfoDockAction->setIcon(QIcon(":/assistant-info.svg"));
#endif
    m_showAssistantInfoDockAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_2));
}
开发者ID:JoyIfBam5,项目名称:plantumlqeditor,代码行数:53,代码来源:mainwindow.cpp

示例2: QMainWindow

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    this->setWindowIcon(QIcon(":res/123.png"));
    mdi = new QMdiArea(this);
    this->setCentralWidget(mdi);
    QDockWidget* dock = new QDockWidget(tr("Script log"),this);
    dock->setObjectName(tr("ScriptLogDock"));
    logText = new QTextEdit(dock);
    logText->setReadOnly(true);
    logText->setLineWrapMode(QTextEdit::NoWrap);
    dock->setWidget(logText);
    this->addDockWidget(Qt::BottomDockWidgetArea, dock);

    run_script_init(this);

    // make sure the about menu is shown
    QMenu* menu = 0;
    QList<QAction*> list = menuBar()->actions();
    foreach(QAction* act, list){
        if( act->text().contains(tr("help"),Qt::CaseInsensitive) ){
            menu = act->menu();
        }
    }

    if(menu == 0){
        menu = menuBar()->addMenu(tr("&Help"));
    }
    menu->addAction(dock->toggleViewAction());
    menu->addSeparator();
    QAction* act = menu->addAction(tr("&About..."));
    connect(act,SIGNAL(triggered()),this,SLOT(my_about()));
    this->setWindowTitle(tr("X Toolbox (Beta)"));
}
开发者ID:Jacob1988,项目名称:lxyppc-serial,代码行数:34,代码来源:mainwindow.cpp

示例3: dockLocationChanged

void tst_QDockWidget::dockLocationChanged()
{
    qRegisterMetaType<Qt::DockWidgetArea>("Qt::DockWidgetArea");

    QMainWindow mw;
    QDockWidget dw;
    dw.setObjectName("dock1");
    QSignalSpy spy(&dw, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)));

    mw.addDockWidget(Qt::LeftDockWidgetArea, &dw);
    QCOMPARE(spy.count(), 1);
    QCOMPARE(qvariant_cast<Qt::DockWidgetArea>(spy.at(0).at(0)),
                Qt::LeftDockWidgetArea);
    spy.clear();

    mw.addDockWidget(Qt::LeftDockWidgetArea, &dw);
    QCOMPARE(spy.count(), 1);
    QCOMPARE(qvariant_cast<Qt::DockWidgetArea>(spy.at(0).at(0)),
                Qt::LeftDockWidgetArea);
    spy.clear();

    mw.addDockWidget(Qt::RightDockWidgetArea, &dw);
    QCOMPARE(spy.count(), 1);
    QCOMPARE(qvariant_cast<Qt::DockWidgetArea>(spy.at(0).at(0)),
                Qt::RightDockWidgetArea);
    spy.clear();

    mw.removeDockWidget(&dw);
    QCOMPARE(spy.count(), 0);

    QDockWidget dw2;
    dw2.setObjectName("dock2");
    mw.addDockWidget(Qt::TopDockWidgetArea, &dw2);
    mw.tabifyDockWidget(&dw2, &dw);
    QCOMPARE(spy.count(), 1);
    QCOMPARE(qvariant_cast<Qt::DockWidgetArea>(spy.at(0).at(0)),
                Qt::TopDockWidgetArea);
    spy.clear();

    mw.splitDockWidget(&dw2, &dw, Qt::Horizontal);
    QCOMPARE(spy.count(), 1);
    QCOMPARE(qvariant_cast<Qt::DockWidgetArea>(spy.at(0).at(0)),
                Qt::TopDockWidgetArea);
    spy.clear();

    dw.setFloating(true);
    QTest::qWait(100);
    dw.setFloating(false);
    QTest::qWait(100);
    QCOMPARE(spy.count(), 1);
    QCOMPARE(qvariant_cast<Qt::DockWidgetArea>(spy.at(0).at(0)),
             Qt::TopDockWidgetArea);
    spy.clear();

    QByteArray ba = mw.saveState();
    mw.restoreState(ba);
    QCOMPARE(spy.count(), 1);
    QCOMPARE(qvariant_cast<Qt::DockWidgetArea>(spy.at(0).at(0)),
             Qt::TopDockWidgetArea);
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:60,代码来源:tst_qdockwidget.cpp

示例4: 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;
}
开发者ID:KeeganRen,项目名称:qt-creator,代码行数:29,代码来源:debuggermainwindow.cpp

示例5: createDockWidget

void MainWindow::createDockWidget()
{
    CreateDockWidgetDialog dialog(this);
    int ret = dialog.exec();
    if (ret == QDialog::Rejected)
        return;

    QDockWidget *dw = new QDockWidget;
    dw->setObjectName(dialog.objectName());
    dw->setWindowTitle(dialog.objectName());
    dw->setWidget(new QTextEdit);

    Qt::DockWidgetArea area = dialog.location();
    switch (area) {
        case Qt::LeftDockWidgetArea:
        case Qt::RightDockWidgetArea:
        case Qt::TopDockWidgetArea:
        case Qt::BottomDockWidgetArea:
            addDockWidget(area, dw);
            break;
        default:
            if (!restoreDockWidget(dw)) {
                QMessageBox::warning(this, QString(), tr("Failed to restore dock widget"));
                delete dw;
                return;
            }
            break;
    }

    extraDockWidgets.append(dw);
    destroyDockWidgetMenu->setEnabled(true);
    destroyDockWidgetMenu->addAction(new QAction(dialog.objectName(), this));
}
开发者ID:RobertoMalatesta,项目名称:emscripten-qt,代码行数:33,代码来源:mainwindow.cpp

示例6: addDockWindow

/**
 * Adds a new dock window to the main window and embeds the given \a widget.
 */
QDockWidget* DockWindowManager::addDockWindow(const char* name, QWidget* widget, Qt::DockWidgetArea pos)
{
    // creates the dock widget as container to embed this widget
    MainWindow* mw = getMainWindow();
    QDockWidget* dw = new QDockWidget(mw);
    // Note: By default all dock widgets are hidden but the user can show them manually in the view menu.
    // First, hide immediately the dock widget to avoid flickering, after setting up the dock widgets
    // MainWindow::loadLayoutSettings() is called to restore the layout.
    dw->hide();
    switch (pos) {
    case Qt::LeftDockWidgetArea:
    case Qt::RightDockWidgetArea:
    case Qt::TopDockWidgetArea:
    case Qt::BottomDockWidgetArea:
        mw->addDockWidget(pos, dw);
    default:
        break;
    }
    connect(dw, SIGNAL(destroyed(QObject*)),
            this, SLOT(onDockWidgetDestroyed(QObject*)));
    connect(widget, SIGNAL(destroyed(QObject*)),
            this, SLOT(onWidgetDestroyed(QObject*)));

    // add the widget to the dock widget
    widget->setParent(dw);
    dw->setWidget(widget);

    // set object name and window title needed for i18n stuff
    dw->setObjectName(QLatin1String(name));
    dw->setWindowTitle(QDockWidget::trUtf8(name));
    dw->setFeatures(QDockWidget::AllDockWidgetFeatures);

    d->_dockedWindows.push_back(dw);
    return dw;
}
开发者ID:3DPrinterGuy,项目名称:FreeCAD,代码行数:38,代码来源:DockWindowManager.cpp

示例7: addAsDockWidget

void MainWindow::addAsDockWidget(QWidget* widget)
{
	QDockWidget* dockWidget = new QDockWidget(widget->windowTitle(), this);
	dockWidget->setObjectName(widget->objectName() + "DockWidget");
	dockWidget->setWidget(widget);
	QMainWindow::addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
}
开发者ID:christiana,项目名称:blackbook,代码行数:7,代码来源:bbMainWindow.cpp

示例8: createDockWidget

QDockWidget* DebuggerMainWnd::createDockWidget(const char* name, const QString& title)
{
    QDockWidget* w = new QDockWidget(title, this);
    w->setObjectName(name);
    // view menu changes when docking state changes
    connect(w, SIGNAL(visibilityChanged(bool)), SLOT(updateUI()));
    return w;
}
开发者ID:albfan,项目名称:kdbg,代码行数:8,代码来源:dbgmainwnd.cpp

示例9: createDockWidget

QDockWidget* ConsoleWidgetCollection::createDockWidget(QWidget* widget)
{
		QDockWidget* dockWidget = new QDockWidget(widget->windowTitle(), this);
		connect(widget, &QWidget::windowTitleChanged, this, &ConsoleWidgetCollection::onConsoleWindowTitleChanged);
		dockWidget->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable);
		dockWidget->setObjectName(widget->objectName() + "DockWidget");
		dockWidget->setWidget(widget);
		return dockWidget;
}
开发者ID:c0ns0le,项目名称:CustusX,代码行数:9,代码来源:cxConsoleWidgetCollection.cpp

示例10: createDockWindows

void DesktopMainWindow::createDockWindows()
{
	QDockWidget *catalogDock = new QDockWidget(tr("Base Map"), this);
  catalogDock->setObjectName(tr("CATALOG_DOCK_WINDOW"));
  catalogDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
	MapLayerCatalogWidget* layerCatalog = new MapLayerCatalogWidget(_app);
	catalogDock->setWidget(layerCatalog);
	addDockWidget(Qt::LeftDockWidgetArea, catalogDock);
  _viewMenu->insertAction(_viewSeparator, catalogDock->toggleViewAction());

	QDockWidget *serverDock = new QDockWidget(tr("User Data"), this);
  serverDock->setObjectName(tr("SERVER_DOCK_WINDOW"));
  serverDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
	_serverManager = new ServerManagementWidget(_app);
	serverDock->setWidget(_serverManager);
	addDockWidget(Qt::LeftDockWidgetArea, serverDock);
	_viewMenu->insertAction(_viewSeparator, serverDock->toggleViewAction());
}
开发者ID:KrisLee,项目名称:godzi-desktop,代码行数:18,代码来源:DesktopMainWindow.cpp

示例11: settings

Tab::Tab(QWidget *parent) :
    QMainWindow(parent)
{
    //Setting code field
    code = new CodeEditor;
    setCentralWidget(code);

    //Setting input and output fields
    input = new RuQTextEdit;
    output = new RuQTextEdit;
    output->setReadOnly(true);
    inputLayout = new QVBoxLayout;
    outputLayout = new QVBoxLayout;
    inputLayout->addWidget(input);
    outputLayout->addWidget(output);

    setDockOptions(QMainWindow::AllowNestedDocks | QMainWindow::AnimatedDocks);

    QDockWidget *inputDock = new QDockWidget(tr("Input"), this);
    inputDock->setAllowedAreas(Qt::AllDockWidgetAreas);
    inputWidget = new QWidget(inputDock);
    inputWidget->setLayout(inputLayout);
    inputDock->setWidget(inputWidget);
    inputDock->setFeatures(QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetMovable);
    addDockWidget(Qt::RightDockWidgetArea, inputDock);
    inputDock->setObjectName("inputDock");

    QDockWidget *outputDock = new QDockWidget(tr("Output"), this);
    outputDock->setAllowedAreas(Qt::AllDockWidgetAreas);
    outputWidget = new QWidget(outputDock);
    outputWidget->setLayout(outputLayout);
    outputDock->setWidget(outputWidget);
    outputDock->setFeatures(QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetMovable);
    addDockWidget(Qt::RightDockWidgetArea, outputDock);
    outputDock->setObjectName("outputDock");

    //Setting io and code fonts
    setFonts();

    //restore state
    QSettings settings("SASM Project", "SASM");
    restoreGeometry(settings.value("tabgeometry").toByteArray());
    restoreState(settings.value("tabwindowstate").toByteArray());
}
开发者ID:0x0all,项目名称:SASM,代码行数:44,代码来源:tab.cpp

示例12: showTileScale

void QgsTileScaleWidget::showTileScale( QMainWindow *mainWindow )
{
  QDockWidget *dock = mainWindow->findChild<QDockWidget *>( "theTileScaleDock" );
  if ( dock )
  {
    dock->setVisible( dock->isHidden() );
    return;
  }

  QgsMapCanvas *canvas = mainWindow->findChild<QgsMapCanvas *>( "theMapCanvas" );
  QgsDebugMsg( QString( "canvas:%1 [%2]" ).arg(( ulong ) canvas, 0, 16 ).arg( canvas ? canvas->objectName() : "" ) );
  if ( !canvas )
  {
    QgsDebugMsg( "map canvas theMapCanvas not found" );
    return;
  }

  QgsTileScaleWidget *tws = new QgsTileScaleWidget( canvas );
  tws->setObjectName( "theTileScaleWidget" );

  QObject *legend = mainWindow->findChild<QObject*>( "theLayerTreeView" );
  if ( legend )
  {
    connect( legend, SIGNAL( currentLayerChanged( QgsMapLayer* ) ),
             tws, SLOT( layerChanged( QgsMapLayer* ) ) );
  }
  else
  {
    QgsDebugMsg( "legend not found" );
  }

  //create the dock widget
  dock = new QDockWidget( tr( "Tile Scale Panel" ), mainWindow );
  dock->setObjectName( "theTileScaleDock" );
  dock->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
  mainWindow->addDockWidget( Qt::RightDockWidgetArea, dock );

  // add to the Panel submenu
  QMenu *panelMenu = mainWindow->findChild<QMenu *>( "mPanelMenu" );
  if ( panelMenu )
  {
    // add to the Panel submenu
    panelMenu->addAction( dock->toggleViewAction() );
  }
  else
  {
    QgsDebugMsg( "panel menu not found" );
  }

  dock->setWidget( tws );

  connect( dock, SIGNAL( visibilityChanged( bool ) ), tws, SLOT( scaleEnabled( bool ) ) );

  QSettings settings;
  dock->setVisible( settings.value( "/UI/tileScaleEnabled", false ).toBool() );
}
开发者ID:stevenmizuno,项目名称:QGIS,代码行数:56,代码来源:qgstilescalewidget.cpp

示例13: createDockPanel

/******************************************************************************
* Creates a dock panel.
******************************************************************************/
void MainWindow::createDockPanel(const QString& caption, const QString& objectName, Qt::DockWidgetArea dockArea, Qt::DockWidgetAreas allowedAreas, QWidget* contents)
{
	QDockWidget* dockWidget = new QDockWidget(caption, this);
	dockWidget->setObjectName(objectName);
	dockWidget->setAllowedAreas(allowedAreas);
	dockWidget->setFeatures(QDockWidget::DockWidgetClosable);
	dockWidget->setWidget(contents);
	dockWidget->setTitleBarWidget(new QWidget());
	addDockWidget(dockArea, dockWidget);
}
开发者ID:bitzhuwei,项目名称:OVITO_sureface,代码行数:13,代码来源:MainWindow.cpp

示例14: createDockWidget

QDockWidget* MainWindow::createDockWidget(KoDockFactoryBase* factory)
{
    QDockWidget* dockWidget = 0;

    if(!m_dockWidgetMap.contains(factory->id())) {
        dockWidget = factory->createDockWidget();

        // It is quite possible that a dock factory cannot create the dock; don't
        // do anything in that case.
        if(!dockWidget) return 0;
        m_dockWidgets.push_back(dockWidget);

        dockWidget->setObjectName(factory->id());
        dockWidget->setParent(this);

        if(dockWidget->widget() && dockWidget->widget()->layout())
            dockWidget->widget()->layout()->setContentsMargins(1, 1, 1, 1);

        Qt::DockWidgetArea side = Qt::RightDockWidgetArea;
        bool visible = true;

        switch(factory->defaultDockPosition()) {
        case KoDockFactoryBase::DockTornOff:
            dockWidget->setFloating(true); // position nicely?
            break;
        case KoDockFactoryBase::DockTop:
            side = Qt::TopDockWidgetArea; break;
        case KoDockFactoryBase::DockLeft:
            side = Qt::LeftDockWidgetArea; break;
        case KoDockFactoryBase::DockBottom:
            side = Qt::BottomDockWidgetArea; break;
        case KoDockFactoryBase::DockRight:
            side = Qt::RightDockWidgetArea; break;
        case KoDockFactoryBase::DockMinimized:
            visible = false; break;
        default:;
        }

        addDockWidget(side, dockWidget);
        if(dockWidget->features() & QDockWidget::DockWidgetClosable) {
            m_dockWidgetMenu->addAction(dockWidget->toggleViewAction());
            if(!visible)
                dockWidget->hide();
        }

        m_dockWidgetMap.insert(factory->id(), dockWidget);
    } else {
        dockWidget = m_dockWidgetMap[ factory->id()];
    }

    connect(dockWidget, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(forceDockTabFonts()));

    return dockWidget;
}
开发者ID:foren197316,项目名称:calligra,代码行数:54,代码来源:MainWindow.cpp

示例15: addToolWindows

DockedMainWindow::DockWidgetList DockedMainWindow::addToolWindows(const DesignerToolWindowList &tls)
{
    DockWidgetList rc;
    foreach (QDesignerToolWindow *tw, tls) {
        QDockWidget *dockWidget = new QDockWidget;
        dockWidget->setObjectName(tw->objectName() + QLatin1String("_dock"));
        dockWidget->setWindowTitle(tw->windowTitle());
        addDockWidget(tw->dockWidgetAreaHint(), dockWidget);
        dockWidget->setWidget(tw);
        rc.push_back(dockWidget);
    }
开发者ID:stephaneAG,项目名称:PengPod700,代码行数:11,代码来源:mainwindow.cpp


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