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


C++ QDockWidget类代码示例

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


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

示例1: itemAt

void ProtobufTree::contextMenuEvent(QContextMenuEvent* e) {
    QMenu menu;

    QAction* expandItemAction = nullptr, * collapseItemAction = nullptr;
    QTreeWidgetItem* item = itemAt(e->pos());
    if (item) {
        expandItemAction = menu.addAction("Expand");
        collapseItemAction = menu.addAction("Collapse");
        menu.addSeparator();
    }

    QAction* expandMessagesAction = menu.addAction("Expand Only Messages");
    menu.addSeparator();

    QAction* expandAction = menu.addAction("Expand All");
    QAction* collapseAction = menu.addAction("Collapse All");
    menu.addSeparator();

    QAction* showTags = menu.addAction("Show tags");
    showTags->setCheckable(true);
    showTags->setChecked(!isColumnHidden(Column_Tag));

    menu.addSeparator();

    QAction* chartAction = nullptr;
    QAction* exportAction = nullptr;
    QList<QAction*> chartMenuActions;

    QList<QDockWidget*> dockWidgets;
    const FieldDescriptor* field = nullptr;
    if (mainWindow && item) {
        field = item->data(Column_Tag, FieldDescriptorRole)
                    .value<const FieldDescriptor*>();
        if (field) {
            int t = field->type();
            if (t == FieldDescriptor::TYPE_FLOAT ||
                t == FieldDescriptor::TYPE_DOUBLE ||
                (t == FieldDescriptor::TYPE_MESSAGE &&
                 field->message_type()->name() == "Point")) {
                dockWidgets = mainWindow->findChildren<QDockWidget*>();
                if (!dockWidgets.isEmpty()) {
                    QMenu* chartMenu = menu.addMenu("Chart");
                    chartAction = chartMenu->addAction("New Chart");
                    exportAction = chartMenu->addAction("Export Chart");
                    chartMenu->addSeparator();
                    for (int i = 0; i < dockWidgets.size(); ++i) {
                        chartMenuActions.append(chartMenu->addAction(
                            QString("Add to '%1'")
                                .arg(dockWidgets[0]->windowTitle())));
                    }
                } else {
                    chartAction = menu.addAction("New Chart");
                }
            }
        }
    }

    QAction* act = menu.exec(mapToGlobal(e->pos()));
    if (act == expandMessagesAction) {
        collapseAll();
        expandMessages();
    } else if (act == expandAction) {
        expandAll();
    } else if (act == collapseAction) {
        collapseAll();
    } else if (act == showTags) {
        setColumnHidden(Column_Tag, !showTags->isChecked());
    } else if (expandItemAction && act == expandItemAction) {
        expandSubtree(item);
    } else if (collapseItemAction && act == collapseItemAction) {
        collapseSubtree(item);
    } else if (chartAction && act == chartAction) {
        // Find the path from LogFrame to the chosen item
        QVector<int> path;
        QStringList names;
        for (QTreeWidgetItem* i = item; i; i = i->parent()) {
            int tag = i->data(Column_Tag, Qt::DisplayRole).toInt();
            path.push_back(tag);
            names.append(i->text(Column_Field));
        }

        reverse(path.begin(), path.end());
        reverse(names.begin(), names.end());

        QDockWidget* dock = new QDockWidget(names.join("."), mainWindow);
        StripChart* chart = new StripChart(dock);
        chart->history(_history);

        if (field->type() == FieldDescriptor::TYPE_MESSAGE) {
            Chart::PointMagnitude* f = new Chart::PointMagnitude;
            f->path = path;
            f->name = names.join(".");
            chart->function(f);
        } else {
            Chart::NumericField* f = new Chart::NumericField;
            f->path = path;
            f->name = names.join(".");
            chart->function(f);
        }
        dock->setAttribute(Qt::WA_DeleteOnClose);
//.........这里部分代码省略.........
开发者ID:RoboJackets,项目名称:robocup-software,代码行数:101,代码来源:ProtobufTree.cpp

示例2: QMainWindow

DSPWindow::DSPWindow(QWidget *parent)
  : QMainWindow(parent)
{
  owDate = new QDate;
  *owDate = QDate::currentDate();

  // Меню - Файл ---------------------------------------------------------------
  QToolBar *tb = new QToolBar(this);
  tb->setWindowTitle(tr("File Actions"));
  addToolBar(tb);

  QMenu *menu = new QMenu(tr("&File"), this);
  menuBar()->addMenu(menu);

  QAction *a;
    
  a = new QAction(QIcon(rsrcPath + "/filenew.png"), tr("&New"), this);
  a->setShortcut(Qt::CTRL + Qt::Key_N);
  //connect(a, SIGNAL(triggered()), this, SLOT(fileNew()));
  tb->addAction(a);
  menu->addAction(a);

  a = new QAction(QIcon(rsrcPath + "/fileopen.png"), tr("&Open..."), this);
  a->setShortcut(Qt::CTRL + Qt::Key_O);
  //connect(a, SIGNAL(triggered()), this, SLOT(fileOpen()));
  tb->addAction(a);
  menu->addAction(a);

  menu->addSeparator();

  actionSave = a = new QAction(QIcon(rsrcPath + "/filesave.png"), tr("&Save"), this);
  a->setShortcut(Qt::CTRL + Qt::Key_S);
  //connect(a, SIGNAL(triggered()), this, SLOT(fileSave()));
  a->setEnabled(false);
  tb->addAction(a);
  menu->addAction(a);

  a = new QAction(tr("Save &As..."), this);
  //connect(a, SIGNAL(triggered()), this, SLOT(fileSaveAs()));
  menu->addAction(a);
  menu->addSeparator();

  a = new QAction(QIcon(rsrcPath + "/fileprint.png"), tr("&Print..."), this);
  a->setShortcut(Qt::CTRL + Qt::Key_P);
  //connect(a, SIGNAL(triggered()), this, SLOT(filePrint()));
  tb->addAction(a);
  menu->addAction(a);

  a = new QAction(QIcon(rsrcPath + "/exportpdf.png"), tr("&Export PDF..."), this);
  a->setShortcut(Qt::CTRL + Qt::Key_D);
  //connect(a, SIGNAL(triggered()), this, SLOT(filePrintPdf()));
  tb->addAction(a);
  menu->addAction(a);

  menu->addSeparator();

  a = new QAction(tr("&Quit"), this);
  a->setShortcut(Qt::CTRL + Qt::Key_Q);
  connect(a, SIGNAL(triggered()), this, SLOT(close()));
  menu->addAction(a);
  // Меню - Файл ..............................................................


  // Навигатор ----------------------------------------------------------------
  //QPalette palette( Qt::gray );
  //palette.setColor( QPalette::Button , QColor(Qt::white));

  navigator = new QDockWidget(tr("Навигатор"), this);
  navigator->setFeatures( navigator->features() ^ QDockWidget::DockWidgetClosable );
  navigator->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
  navigator->setMaximumSize(QSize( NButtonWidth + 40 , 16777215)); // <- Задаем фиксированный размер
  navigator->setMinimumSize(QSize( NButtonWidth + 40 , 0)); // <----------|

  addDockWidget(Qt::LeftDockWidgetArea, navigator );
    
  navigatorBox = new QToolBox( navigator );
  navigatorBox->setFrameShape( QFrame::Panel );
  navigatorBox->setFrameShadow( QFrame::Plain );
  navigatorBox->setLineWidth(1);
  //navigatorBox->setPalette( palette );
  navigator->setWidget( navigatorBox );

  navigatorButtonGroup = new QButtonGroup;
  navigatorButtonGroup->setExclusive ( true );
  connect( navigatorButtonGroup , SIGNAL(buttonClicked ( int )), 
	   this, SLOT(selectPageInMainLayout( int )));

  NavigatorButton *navigatorButton;
  NavigatorLabel *navigatorLabel;

  // Оперативная работа ---
  QWidget *pageOpWork = new QWidget();

  QVBoxLayout *pageOpWorkVboxLayout = new QVBoxLayout( pageOpWork );
  pageOpWorkVboxLayout->setSpacing(6);
  pageOpWorkVboxLayout->setMargin(9);

  navigatorBox->addItem( pageOpWork , tr( "Оперативная работа" ));
  navigatorBox->setItemIcon ( 0 , QIcon( piconPath + "/32/ow.png") );
  // ее кнопки 
//.........这里部分代码省略.........
开发者ID:povloid,项目名称:projects_before_2007,代码行数:101,代码来源:dsp.cpp

示例3: QRect

void KoDockWidgetTitleBar::resizeEvent(QResizeEvent*)
{
    QDockWidget *q = qobject_cast<QDockWidget*>(parentWidget());

    int fw = q->isFloating() ? q->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, q) : 0;

    QStyleOptionDockWidgetV2 opt;
    opt.initFrom(q);
    opt.rect = QRect(QPoint(fw, fw), QSize(geometry().width() - (fw * 2), geometry().height() - (fw * 2)));
    opt.title = q->windowTitle();
    opt.closable = hasFeature(q, QDockWidget::DockWidgetClosable);
    opt.floatable = hasFeature(q, QDockWidget::DockWidgetFloatable);

    QRect floatRect = q->style()->subElementRect(QStyle::SE_DockWidgetFloatButton, &opt, q);
    if (!floatRect.isNull())
        d->floatButton->setGeometry(floatRect);

    QRect closeRect = q->style()->subElementRect(QStyle::SE_DockWidgetCloseButton, &opt, q);
    if (!closeRect.isNull())
        d->closeButton->setGeometry(closeRect);

    int top = fw;
    if (!floatRect.isNull())
        top = floatRect.y();
    else if (!closeRect.isNull())
        top = closeRect.y();

    QSize size = d->collapseButton->size();
    if (!closeRect.isNull()) {
        size = d->closeButton->size();
    } else if (!floatRect.isNull()) {
        size = d->floatButton->size();
    }
    QRect collapseRect = QRect(QPoint(fw, top), size);
    d->collapseButton->setGeometry(collapseRect);

    size = d->lockButton->size();

    if (!closeRect.isNull()) {
        size = d->closeButton->size();
    } else if (!floatRect.isNull()) {
        size = d->floatButton->size();
    }

    int offset = 0;

    if (d->collapsable) {
        offset = collapseRect.width();
    }
    QRect lockRect = QRect(QPoint(fw + 2 + offset, top), size);
    d->lockButton->setGeometry(lockRect);

    if (width() < (closeRect.width() + lockRect.width()) + 50) {
        d->collapsable = false;
        d->collapseButton->setVisible(false);
        d->lockButton->setVisible(false);
        d->lockable = false;
    } else {
        d->collapsable = d->collapsableSet;
        d->collapseButton->setVisible(d->collapsableSet);
        d->lockButton->setVisible(true);
        d->lockable = true;
    }
}
开发者ID:ChrisJong,项目名称:krita,代码行数:64,代码来源:KoDockWidgetTitleBar.cpp

示例4: m_progressBar


//.........这里部分代码省略.........
    shaderMenu->addSeparator();

    // Help menu
    QMenu* helpMenu = menuBar()->addMenu(tr("&Help"));
    QAction* helpAct = helpMenu->addAction(tr("User &Guide"));
    connect(helpAct, SIGNAL(triggered()), this, SLOT(helpDialog()));
    helpMenu->addSeparator();
    QAction* aboutAct = helpMenu->addAction(tr("&About"));
    connect(aboutAct, SIGNAL(triggered()), this, SLOT(aboutDialog()));


    //--------------------------------------------------
    // Point viewer
    m_pointView = new View3D(m_geometries, format, this);
    setCentralWidget(m_pointView);
    connect(drawBoundingBoxes, SIGNAL(triggered()),
            m_pointView, SLOT(toggleDrawBoundingBoxes()));
    connect(drawCursor, SIGNAL(triggered()),
            m_pointView, SLOT(toggleDrawCursor()));
    connect(drawAxes, SIGNAL(triggered()),
            m_pointView, SLOT(toggleDrawAxes()));
    connect(drawGrid, SIGNAL(triggered()),
            m_pointView, SLOT(toggleDrawGrid()));
    connect(drawAnnotations, SIGNAL(triggered()),
            m_pointView, SLOT(toggleDrawAnnotations()));
    connect(trackballMode, SIGNAL(triggered()),
            m_pointView, SLOT(toggleCameraMode()));
    connect(m_geometries, SIGNAL(rowsInserted(QModelIndex,int,int)),
            this, SLOT(geometryRowsInserted(QModelIndex,int,int)));

    //--------------------------------------------------
    // Docked widgets
    // Shader parameters UI
    QDockWidget* shaderParamsDock = new QDockWidget(tr("Shader Parameters"), this);
    shaderParamsDock->setFeatures(QDockWidget::DockWidgetMovable |
                                  QDockWidget::DockWidgetClosable);
    QWidget* shaderParamsUI = new QWidget(shaderParamsDock);
    shaderParamsDock->setWidget(shaderParamsUI);
    m_pointView->setShaderParamsUIWidget(shaderParamsUI);

    // Shader editor UI
    QDockWidget* shaderEditorDock = new QDockWidget(tr("Shader Editor"), this);
    shaderEditorDock->setFeatures(QDockWidget::DockWidgetMovable |
                                  QDockWidget::DockWidgetClosable |
                                  QDockWidget::DockWidgetFloatable);
    QWidget* shaderEditorUI = new QWidget(shaderEditorDock);
    m_shaderEditor = new ShaderEditor(shaderEditorUI);
    QGridLayout* shaderEditorLayout = new QGridLayout(shaderEditorUI);
    shaderEditorLayout->setContentsMargins(2,2,2,2);
    shaderEditorLayout->addWidget(m_shaderEditor, 0, 0, 1, 1);
    connect(editShaderAct, SIGNAL(triggered()), shaderEditorDock, SLOT(show()));
    shaderEditorDock->setWidget(shaderEditorUI);

    shaderMenu->addAction(m_shaderEditor->compileAction());
    connect(m_shaderEditor->compileAction(), SIGNAL(triggered()),
            this, SLOT(compileShaderFile()));

    // TODO: check if this is needed - test shader update functionality
    //connect(m_shaderEditor, SIGNAL(sendShader(QString)),
    //        &m_pointView->shaderProgram(), SLOT(setShader(QString)));

    // Log viewer UI
    QDockWidget* logDock = new QDockWidget(tr("Log"), this);
    logDock->setFeatures(QDockWidget::DockWidgetMovable |
                         QDockWidget::DockWidgetClosable);
    QWidget* logUI = new QWidget(logDock);
开发者ID:nigels-com,项目名称:displaz,代码行数:67,代码来源:PointViewerMainWindow.cpp

示例5: QDockWidget

QDockWidget *Customizer::produceDockWidget(QString const &title, QWidget *content) const
{
	QDockWidget *dock = new QDockWidget(title);
	dock->setWidget(content);
	return dock;
}
开发者ID:Anna-,项目名称:qreal,代码行数:6,代码来源:customizer.cpp

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

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

示例7: QMainWindow

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{

    ui->setupUi(this);
    this->resize(800,680);
    this->setWindowState(Qt::WindowMaximized);
    ImageItem *image = new ImageItem();

    //create ColorSelection
    ColorSelection *CS1 = new ColorSelection(Qt::black);
    ColorSelection *CS2 = new ColorSelection(Qt::white);
    QObject::connect(CS1,SIGNAL(changeColor(QColor)),image,SLOT(setColor1(QColor)));
    QObject::connect(image->getPipette(),SIGNAL(changeColor1(QColor)),CS1,SLOT(setColor(QColor)));
    QObject::connect(CS2,SIGNAL(changeColor(QColor)),image,SLOT(setColor2(QColor)));
    QObject::connect(image->getPipette(),SIGNAL(changeColor2(QColor)),CS2,SLOT(setColor(QColor)));
    QHBoxLayout *Hlayout = new QHBoxLayout();
    Hlayout->addStretch(5);
    Hlayout->addWidget(CS1);
    Hlayout->addWidget(CS2);
    Hlayout->addStretch(5);

    //Create slider
    QSlider *slider = new QSlider(Qt::Horizontal);
    slider->setMaximum(100);
    slider->setMinimum(1);
    slider->setValue(10);
    QObject::connect(slider,SIGNAL(valueChanged(int)),image,SLOT(setSize(int)));


    QVBoxLayout *Blayout = new QVBoxLayout();
    Blayout->addWidget(slider);
    Blayout->addLayout(Hlayout);
    QWidget *wdg = new QWidget();
    wdg->setLayout(Blayout);
    // Create Dock
    //
    //
    QDockWidget *dock = new QDockWidget(tr("Настройка"),this);
    dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
    dock->setFeatures(QDockWidget::NoDockWidgetFeatures);
    wdg->setFixedSize(200,100);
    dock->setWidget(wdg);
    dock->setMaximumHeight(300);
    dock->setMaximumWidth(300);

    addDockWidget(Qt::RightDockWidgetArea,dock);

    QActionGroup *GP = new QActionGroup(this);
    GP->addAction(ui->actionPencil);
    GP->addAction(ui->actionEraser);
    GP->addAction(ui->actionEllipse);
    GP->addAction(ui->actionRectangle);
    GP->addAction(ui->actionLine);
    GP->addAction(ui->actionCurveLine);
    GP->addAction(ui->actionFill);
    GP->addAction(ui->actionPipette);
    GP->addAction(ui->actionSelection);
    GP->setExclusive(true);

    //create tool bar
    QToolBar *TB = new QToolBar();
    TB->setAllowedAreas(Qt::TopToolBarArea | Qt::LeftToolBarArea);
    TB->setFloatable(false);
    TB->setMovable(true);

    TB->insertAction(0,ui->actionSaveAs);
    TB->insertAction(ui->actionSaveAs,ui->actionSave);
    TB->insertAction(ui->actionSave,ui->actionOpen);
    TB->insertAction(ui->actionOpen,ui->actionCreate);
    TB->addSeparator();
    TB->insertAction(0,ui->actionSelection);
    TB->insertAction(ui->actionSelection,ui->actionPipette);
    TB->insertAction(ui->actionPipette,ui->actionFill);
    TB->insertAction(ui->actionFill,ui->actionCurveLine);
    TB->insertAction(ui->actionCurveLine,ui->actionLine);
    TB->insertAction(ui->actionLine,ui->actionRectangle);
    TB->insertAction(ui->actionRectangle,ui->actionEllipse);
    TB->insertAction(ui->actionEllipse,ui->actionEraser);
    TB->insertAction(ui->actionEraser,ui->actionPencil);




    addToolBar(Qt::TopToolBarArea, TB);
    // create action connecting
    QObject::connect(ui->actionOpen,SIGNAL(triggered(bool)),image,SLOT(open()));
    QObject::connect(ui->actionSaveAs,SIGNAL(triggered(bool)),image,SLOT(saveAs()));
    QObject::connect(ui->actionSave,SIGNAL(triggered(bool)),image,SLOT(save()));
    QObject::connect(ui->actionPencil,SIGNAL(toggled(bool)),image,SLOT(setPencil(bool)));
    QObject::connect(ui->actionEraser,SIGNAL(toggled(bool)),image,SLOT(setEraser(bool)));
    QObject::connect(ui->actionEllipse,SIGNAL(toggled(bool)),image,SLOT(setEllipse(bool)));
    QObject::connect(ui->actionRectangle,SIGNAL(toggled(bool)),image,SLOT(setRectangle(bool)));
    QObject::connect(ui->actionLine,SIGNAL(toggled(bool)),image,SLOT(setLine(bool)));
    QObject::connect(ui->actionCurveLine,SIGNAL(toggled(bool)),image,SLOT(setCurveLine(bool)));
    QObject::connect(ui->actionFill,SIGNAL(toggled(bool)),image,SLOT(setFill(bool)));
    QObject::connect(ui->actionPipette,SIGNAL(toggled(bool)),image,SLOT(setPipette(bool)));
    QObject::connect(ui->actionSelection,SIGNAL(toggled(bool)),image,SLOT(setSelection(bool)));
    //undo and redo
//.........这里部分代码省略.........
开发者ID:Dearg7,项目名称:graphics-editor,代码行数:101,代码来源:mainwindow.cpp

示例8: WindowQt

MainWindow::MainWindow(running_machine* machine, QWidget* parent) :
	WindowQt(machine, NULL),
	m_historyIndex(0),
	m_inputHistory()
{
	setGeometry(300, 300, 1000, 600);

	//
	// The main frame and its input and log widgets
	//
	QFrame* mainWindowFrame = new QFrame(this);

	// The input line
	m_inputEdit = new QLineEdit(mainWindowFrame);
	connect(m_inputEdit, &QLineEdit::returnPressed, this, &MainWindow::executeCommandSlot);
	m_inputEdit->installEventFilter(this);


	// The log view
	m_consoleView = new DebuggerView(DVT_CONSOLE,
										m_machine,
										mainWindowFrame);
	m_consoleView->setFocusPolicy(Qt::NoFocus);
	m_consoleView->setPreferBottom(true);

	QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame);
	vLayout->addWidget(m_consoleView);
	vLayout->addWidget(m_inputEdit);
	vLayout->setSpacing(3);
	vLayout->setContentsMargins(4,0,4,2);

	setCentralWidget(mainWindowFrame);

	//
	// Options Menu
	//
	// Create three commands
	m_breakpointToggleAct = new QAction("Toggle Breakpoint at Cursor", this);
	m_breakpointEnableAct = new QAction("Disable Breakpoint at Cursor", this);
	m_runToCursorAct = new QAction("Run to Cursor", this);
	m_breakpointToggleAct->setShortcut(Qt::Key_F9);
	m_breakpointEnableAct->setShortcut(Qt::SHIFT + Qt::Key_F9);
	m_runToCursorAct->setShortcut(Qt::Key_F4);
	connect(m_breakpointToggleAct, &QAction::triggered, this, &MainWindow::toggleBreakpointAtCursor);
	connect(m_breakpointEnableAct, &QAction::triggered, this, &MainWindow::enableBreakpointAtCursor);
	connect(m_runToCursorAct, &QAction::triggered, this, &MainWindow::runToCursor);

	// Right bar options
	QActionGroup* rightBarGroup = new QActionGroup(this);
	rightBarGroup->setObjectName("rightbargroup");
	QAction* rightActRaw = new QAction("Raw Opcodes", this);
	QAction* rightActEncrypted = new QAction("Encrypted Opcodes", this);
	QAction* rightActComments = new QAction("Comments", this);
	rightActRaw->setCheckable(true);
	rightActEncrypted->setCheckable(true);
	rightActComments->setCheckable(true);
	rightActRaw->setActionGroup(rightBarGroup);
	rightActEncrypted->setActionGroup(rightBarGroup);
	rightActComments->setActionGroup(rightBarGroup);
	rightActRaw->setShortcut(QKeySequence("Ctrl+R"));
	rightActEncrypted->setShortcut(QKeySequence("Ctrl+E"));
	rightActComments->setShortcut(QKeySequence("Ctrl+C"));
	rightActRaw->setChecked(true);
	connect(rightBarGroup, &QActionGroup::triggered, this, &MainWindow::rightBarChanged);

	// Assemble the options menu
	QMenu* optionsMenu = menuBar()->addMenu("&Options");
	optionsMenu->addAction(m_breakpointToggleAct);
	optionsMenu->addAction(m_breakpointEnableAct);
	optionsMenu->addAction(m_runToCursorAct);
	optionsMenu->addSeparator();
	optionsMenu->addActions(rightBarGroup->actions());

	//
	// Images menu
	//
	image_interface_iterator imageIterTest(m_machine->root_device());
	if (imageIterTest.first() != NULL)
	{
		createImagesMenu();
	}

	//
	// Dock window menu
	//
	QMenu* dockMenu = menuBar()->addMenu("Doc&ks");

	setCorner(Qt::TopRightCorner, Qt::TopDockWidgetArea);
	setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);

	// The processor dock
	QDockWidget* cpuDock = new QDockWidget("processor", this);
	cpuDock->setObjectName("cpudock");
	cpuDock->setAllowedAreas(Qt::LeftDockWidgetArea);
	m_procFrame = new ProcessorDockWidget(m_machine, cpuDock);
	cpuDock->setWidget(dynamic_cast<QWidget*>(m_procFrame));

	addDockWidget(Qt::LeftDockWidgetArea, cpuDock);
	dockMenu->addAction(cpuDock->toggleViewAction());

//.........这里部分代码省略.........
开发者ID:ccmurray,项目名称:mame,代码行数:101,代码来源:mainwindow.cpp

示例9: menuBar

MainWindow::MainWindow()
{
    // defaults
    time_ = 0;

    // create menus in menu bar
    QMenu * fileMenu = menuBar()->addMenu("&File");

    // create tool bars
    QToolBar * toolbar = addToolBar("toolbar");

    QToolBar * toolbarBottom = new QToolBar("bottom toolbar", this);
    addToolBar(Qt::BottomToolBarArea, toolbarBottom);

    // new simulation action
    QAction * newSimulationAction = new QAction("New Simulation", this);
    newSimulationAction->setStatusTip("New simulation");
    connect(newSimulationAction, SIGNAL(triggered()), this, SLOT(newSimulation()));

    // open data set action
    /*QAction * openDataSetAction = new QAction("Open Data Set", this);
    openDataSetAction->setStatusTip("Open data set");
    connect(openDataSetAction, SIGNAL(triggered()), this, SLOT(openDataSet()));*/

    // new chart action
    QAction * newChartAction = new QAction("New Chart", this);
    newChartAction->setStatusTip("New chart");
    connect(newChartAction, SIGNAL(triggered()), this, SLOT(newChart()));

#if USE_DISPLAYCLUSTER
    // connect to DisplayCluster action
    QAction * connectToDisplayClusterAction = new QAction("Connect to DisplayCluster", this);
    connectToDisplayClusterAction->setStatusTip("Connect to DisplayCluster");
    connect(connectToDisplayClusterAction, SIGNAL(triggered()), this, SLOT(connectToDisplayCluster()));

    // disconnect from DisplayCluster action
    QAction * disconnectFromDisplayClusterAction = new QAction("Disconnect from DisplayCluster", this);
    disconnectFromDisplayClusterAction->setStatusTip("Disconnect from DisplayCluster");
    connect(disconnectFromDisplayClusterAction, SIGNAL(triggered()), this, SLOT(disconnectFromDisplayCluster()));
#endif

    // add actions to menus
    fileMenu->addAction(newSimulationAction);
    // fileMenu->addAction(openDataSetAction);
    fileMenu->addAction(newChartAction);

#if USE_DISPLAYCLUSTER
    fileMenu->addAction(connectToDisplayClusterAction);
    fileMenu->addAction(disconnectFromDisplayClusterAction);
#endif

    // add actions to toolbar
    toolbar->addAction(newSimulationAction);
    // toolbar->addAction(openDataSetAction);
    toolbar->addAction(newChartAction);

    // make map widgets the main view
    QTabWidget * tabWidget = new QTabWidget();

    IliMapWidget * iliMapWidget = new IliMapWidget();
    tabWidget->addTab(iliMapWidget, "ILI View");

    EpidemicMapWidget * epidemicMapWidget = new EpidemicMapWidget();
    tabWidget->addTab(epidemicMapWidget, "Infected");

    StockpileMapWidget * antiviralsStockpileMapWidget = new StockpileMapWidget();
    antiviralsStockpileMapWidget->setType(STOCKPILE_ANTIVIRALS);
    tabWidget->addTab(antiviralsStockpileMapWidget, "Antivirals Stockpile");

    StockpileMapWidget * vaccinesStockpileMapWidget = new StockpileMapWidget();
    vaccinesStockpileMapWidget->setType(STOCKPILE_VACCINES);
    tabWidget->addTab(vaccinesStockpileMapWidget, "Vaccines Stockpile");

    setCentralWidget(tabWidget);

    // create event monitor and widget
    EventMonitor * eventMonitor = new EventMonitor(this);

    QDockWidget * eventMonitorDockWidget = new QDockWidget("Event Monitor", this);
    eventMonitorDockWidget->setWidget(new EventMonitorWidget(eventMonitor));
    addDockWidget(Qt::TopDockWidgetArea, eventMonitorDockWidget);

    QDockWidget * timelineDockWidget = new QDockWidget("Timeline", this);
    timelineDockWidget->setWidget(new TimelineWidget(this, eventMonitor));
    addDockWidget(Qt::TopDockWidgetArea, timelineDockWidget);

    // tabify event monitor and timeline widgets
    tabifyDockWidget(eventMonitorDockWidget, timelineDockWidget);

    // setup time slider and add it to bottom toolbar with label
    timeSlider_ = new QSlider(Qt::Horizontal, this);
    connect(timeSlider_, SIGNAL(valueChanged(int)), this, SLOT(setTime(int)));
    toolbarBottom->addWidget(new QLabel("Time"));
    toolbarBottom->addWidget(timeSlider_);

    // previous timestep button
    QAction * previousTimestepAction = new QAction(QIcon::fromTheme("media-seek-backward"), "Back", this);
    previousTimestepAction->setStatusTip(tr("Move backward one day"));
    connect(previousTimestepAction, SIGNAL(triggered()), this, SLOT(previousTimestep()));
    toolbarBottom->addAction(previousTimestepAction);
//.........这里部分代码省略.........
开发者ID:knolla,项目名称:PanFluExercise,代码行数:101,代码来源:MainWindow.cpp

示例10: QMainWindow

QT_BEGIN_NAMESPACE

MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent)
    : QMainWindow(parent)
    , m_bookmarkWidget(0)
    , m_filterCombo(0)
    , m_toolBarMenu(0)
    , m_cmdLine(cmdLine)
    , m_progressWidget(0)
    , m_qtDocInstaller(0)
    , m_connectedInitSignals(false)
{
    TRACE_OBJ

    setToolButtonStyle(Qt::ToolButtonFollowStyle);
    setDockOptions(dockOptions() | AllowNestedDocks);

    QString collectionFile;
    if (usesDefaultCollection()) {
        MainWindow::collectionFileDirectory(true);
        collectionFile = MainWindow::defaultHelpCollectionFileName();
    } else {
        collectionFile = cmdLine->collectionFile();
    }
    HelpEngineWrapper &helpEngineWrapper =
        HelpEngineWrapper::instance(collectionFile);
    BookmarkManager *bookMarkManager = BookmarkManager::instance();

    if (!initHelpDB(!cmdLine->collectionFileGiven())) {
        qDebug("Fatal error: Help engine initialization failed. "
            "Error message was: %s\nAssistant will now exit.",
            qPrintable(HelpEngineWrapper::instance().error()));
        std::exit(1);
    }

    m_centralWidget = new CentralWidget(this);
    setCentralWidget(m_centralWidget);

    m_indexWindow = new IndexWindow(this);
    QDockWidget *indexDock = new QDockWidget(tr("Index"), this);
    indexDock->setObjectName(QLatin1String("IndexWindow"));
    indexDock->setWidget(m_indexWindow);
    addDockWidget(Qt::LeftDockWidgetArea, indexDock);

    m_contentWindow = new ContentWindow;
    QDockWidget *contentDock = new QDockWidget(tr("Contents"), this);
    contentDock->setObjectName(QLatin1String("ContentWindow"));
    contentDock->setWidget(m_contentWindow);
    addDockWidget(Qt::LeftDockWidgetArea, contentDock);

    m_searchWindow = new SearchWidget(helpEngineWrapper.searchEngine());
    m_searchWindow->setFont(!helpEngineWrapper.usesBrowserFont() ? qApp->font()
        : helpEngineWrapper.browserFont());
    QDockWidget *searchDock = new QDockWidget(tr("Search"), this);
    searchDock->setObjectName(QLatin1String("SearchWindow"));
    searchDock->setWidget(m_searchWindow);
    addDockWidget(Qt::LeftDockWidgetArea, searchDock);

    QDockWidget *bookmarkDock = new QDockWidget(tr("Bookmarks"), this);
    bookmarkDock->setObjectName(QLatin1String("BookmarkWindow"));
    bookmarkDock->setWidget(m_bookmarkWidget
        = bookMarkManager->bookmarkDockWidget());
    addDockWidget(Qt::LeftDockWidgetArea, bookmarkDock);

    QDockWidget *openPagesDock = new QDockWidget(tr("Open Pages"), this);
    openPagesDock->setObjectName(QLatin1String("Open Pages"));
    OpenPagesManager *openPagesManager
        = OpenPagesManager::createInstance(this, usesDefaultCollection(), m_cmdLine->url());
    openPagesDock->setWidget(openPagesManager->openPagesWidget());
    addDockWidget(Qt::LeftDockWidgetArea, openPagesDock);

    connect(m_centralWidget, SIGNAL(addBookmark(QString, QString)),
        bookMarkManager, SLOT(addBookmark(QString, QString)));
    connect(bookMarkManager, SIGNAL(escapePressed()), this,
            SLOT(activateCurrentCentralWidgetTab()));
    connect(bookMarkManager, SIGNAL(setSource(QUrl)), m_centralWidget,
            SLOT(setSource(QUrl)));
    connect(bookMarkManager, SIGNAL(setSourceInNewTab(QUrl)),
        openPagesManager, SLOT(createPage(QUrl)));

    QHelpSearchEngine *searchEngine = helpEngineWrapper.searchEngine();
    connect(searchEngine, SIGNAL(indexingStarted()), this, SLOT(indexingStarted()));
    connect(searchEngine, SIGNAL(indexingFinished()), this, SLOT(indexingFinished()));

    QString defWindowTitle = tr("Qt Assistant");
    setWindowTitle(defWindowTitle);

    setupActions();
    statusBar()->show();
    m_centralWidget->connectTabBar();

    setupFilterToolbar();
    setupAddressToolbar();

    const QString windowTitle = helpEngineWrapper.windowTitle();
    setWindowTitle(windowTitle.isEmpty() ? defWindowTitle : windowTitle);
    QByteArray iconArray = helpEngineWrapper.applicationIcon();
    if (iconArray.size() > 0) {
        QPixmap pix;
        pix.loadFromData(iconArray);
//.........这里部分代码省略.........
开发者ID:Suneal,项目名称:qt,代码行数:101,代码来源:mainwindow.cpp

示例11: QMainWindow

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent), bonjourResolver(0)
{
    qDebug() << "NUview is starting in: MainWindow.cpp";
    debug.open("debug.log");
    errorlog.open("error.log");

    m_platform = new NUPlatform();                      // you could make the arguement that NUView should have its own platform, for now we just use a 'blank' one
    m_blackboard = new NUBlackboard();
    m_blackboard->add(new NUSensorsData());
    m_blackboard->add(new NUActionatorsData());
    m_blackboard->add(new FieldObjects());
    m_blackboard->add(new JobList());
    m_blackboard->add(new GameInformation(0, 0));
    m_blackboard->add(new TeamInformation(0, 0));
    
    m_nuview_io = new NUviewIO();

    // create mdi workspace
    mdiArea = new QMdiArea(this);
    mdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    mdiArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);

    createActions();
    createMenus();
    createContextMenu();
    createToolBars();
    createStatusBar();

    sensorDisplay = new SensorDisplayWidget(this);
    QDockWidget* sensorDock = new QDockWidget("Sensor Values");
    sensorDock->setObjectName("Sensor Values");
    sensorDock->setWidget(sensorDisplay);
    sensorDock->setShown(false);
    addDockWidget(Qt::RightDockWidgetArea,sensorDock);

    // Add localisation widget
    localisation = new LocalisationWidget(this);
    addDockWidget(Qt::BottomDockWidgetArea,localisation);
    localisation->setVisible(false);

    // Add Vision Widgets to Tab then Dock them on Screen
    visionTabs = new QTabWidget(this);
    layerSelection = new LayerSelectionWidget(mdiArea,this);
    visionTabs->addTab(layerSelection,layerSelection->objectName());
    classification = new ClassificationWidget(this);
    visionTabs->addTab(classification,classification->objectName());
    visionTabDock = new QDockWidget("Vision");
    visionTabDock->setWidget(visionTabs);
    visionTabDock->setObjectName(tr("visionTab"));
    addDockWidget(Qt::RightDockWidgetArea, visionTabDock);
    
    // Add Network widgets to Tabs then dock them on Screen
    networkTabs = new QTabWidget(this);
    connection = new ConnectionWidget(this);
    networkTabs->addTab(connection, connection->objectName());
    walkParameter = new WalkParameterWidget(mdiArea, this);
    kick = new KickWidget(mdiArea, this);
    networkTabs->addTab(walkParameter, walkParameter->objectName());
    networkTabs->addTab(kick, kick->objectName());
    VisionStreamer = new visionStreamWidget(mdiArea, this);
    LocWmStreamer = new locwmStreamWidget(mdiArea, this);
    networkTabs->addTab(VisionStreamer, VisionStreamer->objectName());
    networkTabs->addTab(LocWmStreamer, LocWmStreamer->objectName());
    cameraSetting = new cameraSettingsWidget(mdiArea, this);
    networkTabs->addTab(cameraSetting, cameraSetting->objectName());

    //networkTabs->addTab(kick, kick->objectName());
    networkTabDock = new QDockWidget("Network");
    networkTabDock->setWidget(networkTabs);
    networkTabDock->setObjectName(tr("networkTab"));
    addDockWidget(Qt::RightDockWidgetArea, networkTabDock);

    frameInfo = new frameInformationWidget(this);
    QDockWidget* temp = new QDockWidget(this);
    temp->setWidget(frameInfo);
    temp->setObjectName("Frame Information Dock");
    temp->setWindowTitle(frameInfo->windowTitle());
    addDockWidget(Qt::RightDockWidgetArea,temp);

    createConnections();
    setCentralWidget(mdiArea);
    qDebug() << "Main Window Starting";
    setWindowTitle(QString("NUview"));
    glManager.clearAllDisplays();
    qDebug() << "Display Cleared";
    readSettings();
    qDebug() << "Main Window Started";

    //glManager.writeWMBallToDisplay(100,100,30,GLDisplay::CalGrid);
    glManager.writeCalGridToDisplay(GLDisplay::CalGrid);
    //
    //glManager.writeCalGridToDisplay(GLDisplay::CalGrid);
    //
}
开发者ID:wongosaurus,项目名称:robocup,代码行数:95,代码来源:mainwindow.cpp

示例12: GetQDockWidget

/**
*  @brief
*    Selects the given object
*/
void DockWidgetObject::SelectObject(Object *pObject)
{
	// State change?
	if (m_pObject != pObject) {
		// Disconnect event handler
		if (m_pObject)
			m_pObject->SignalDestroyed.Disconnect(SlotOnDestroyed);

		// Backup the given object pointer
		m_pObject = pObject;

		// Connect event handler
		if (m_pObject)
			m_pObject->SignalDestroyed.Connect(SlotOnDestroyed);

		// Is there a PL introspection model instance?
		if (m_pPLIntrospectionModel) {
			// Set object
			m_pPLIntrospectionModel->SetObject(m_pObject);

			{ // Usability: Resize the first tree view column given to the size of its contents
				// No need to backup current expanded state and restore it after we're done because we set new content above resulting in that all is collapsed when we're in here
				m_pQTreeView->expandAll();
				m_pQTreeView->resizeColumnToContents(0);
				m_pQTreeView->collapseAll();
			}

			// Get encapsulated Qt dock widget and set a decent window title
			QDockWidget *pQDockWidget = GetQDockWidget();
			if (pQDockWidget) {
				// Set window title
				QString sQStringWindowTitle = pQDockWidget->tr(GetClass()->GetProperties().Get("Title"));
				if (m_pObject) { 
					// Append class name
					sQStringWindowTitle += ": ";
					sQStringWindowTitle += QtStringAdapter::PLToQt('\"' + m_pObject->GetClass()->GetClassName() + '\"');	// Put it into quotes to make it possible to see e.g. trailing spaces

					// An "PLCore::Object" itself has no "name", we could show the memory address but this wouldn't be that useful to the user
					// -> Try "GetAbsoluteName()"-method to get an absolute name
					// -> In case there's no name, check whether there's an name attribute
					// -> In case there's still no name, check whether or not there's an filename attribute
					String sName;
					{ // Try "GetAbsoluteName()"-method to get an absolute name
						// Get the typed dynamic parameters
						Params<String> cParams;

						// Call the RTTI method
						m_pObject->CallMethod("GetAbsoluteName", cParams);

						// Get the result
						sName = cParams.Return;
						if (sName.GetLength())
							sName = "Name = \"" + sName + '\"';	// Put it into quotes to make it possible to see e.g. trailing spaces
					}

					// Do we already have a name?
					if (!sName.GetLength()) {
						// Check whether there's an name attribute
						DynVar *pDynVar = m_pObject->GetAttribute("Name");
						if (pDynVar)
							sName = "Name = \"" + pDynVar->GetString() + '\"';	// Put it into quotes to make it possible to see e.g. trailing spaces

						// In case there's still no name, check whether or not there's an filename attribute
						if (!sName.GetLength()) {
							DynVar *pDynVar = m_pObject->GetAttribute("Filename");
							if (pDynVar)
								sName = "Filename = \"" + pDynVar->GetString() + '\"';	// Put it into quotes to make it possible to see e.g. trailing spaces
						}
					}

					// Use the name, if we have one
					if (sName.GetLength()) {
						// We have a representable name, show it to the user
						sQStringWindowTitle += ": ";
						sQStringWindowTitle += QtStringAdapter::PLToQt(sName);
					}
				}
				pQDockWidget->setWindowTitle(sQStringWindowTitle);
			}
		}
	}
}
开发者ID:ByeDream,项目名称:pixellight,代码行数:86,代码来源:DockWidgetObject.cpp

示例13: setGeometry

void QDockWidgetLayout::setGeometry(const QRect &geometry)
{
    QDockWidget *q = qobject_cast<QDockWidget*>(parentWidget());

    bool nativeDeco = nativeWindowDeco();

    int fw = q->isFloating() && !nativeDeco
            ? q->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, q)
            : 0;

    if (nativeDeco) {
        if (QLayoutItem *item = item_list[Content])
            item->setGeometry(geometry);
    } else {
        int titleHeight = this->titleHeight();

        if (verticalTitleBar) {
            _titleArea = QRect(QPoint(fw, fw),
                                QSize(titleHeight, geometry.height() - (fw * 2)));
        } else {
            _titleArea = QRect(QPoint(fw, fw),
                                QSize(geometry.width() - (fw * 2), titleHeight));
        }

        if (QLayoutItem *item = item_list[TitleBar]) {
            item->setGeometry(_titleArea);
        } else {
            QStyleOptionDockWidgetV2 opt;
            q->initStyleOption(&opt);

            if (QLayoutItem *item = item_list[CloseButton]) {
                if (!item->isEmpty()) {
                    QRect r = q->style()
                        ->subElementRect(QStyle::SE_DockWidgetCloseButton,
                                            &opt, q);
                    if (!r.isNull())
                        item->setGeometry(r);
                }
            }

            if (QLayoutItem *item = item_list[FloatButton]) {
                if (!item->isEmpty()) {
                    QRect r = q->style()
                        ->subElementRect(QStyle::SE_DockWidgetFloatButton,
                                            &opt, q);
                    if (!r.isNull())
                        item->setGeometry(r);
                }
            }
        }

        if (QLayoutItem *item = item_list[Content]) {
            QRect r = geometry;
            if (verticalTitleBar) {
                r.setLeft(_titleArea.right() + 1);
                r.adjust(0, fw, -fw, -fw);
            } else {
                r.setTop(_titleArea.bottom() + 1);
                r.adjust(fw, 0, -fw, -fw);
            }
            item->setGeometry(r);
        }
    }
}
开发者ID:cdaffara,项目名称:symbiandump-mw3,代码行数:64,代码来源:qdockwidget.cpp

示例14: QDockWidget

void ResourceBrowser::setupDockWidgets()
{
    QDockWidget* dock = new QDockWidget(i18n("Recommendation"),this);
    dock->setAllowedAreas(Qt::RightDockWidgetArea);
    m_recommendationView = new QListView(dock);
    m_recommendationView->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(m_recommendationView,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(slotRecommendedResourceContextMenu(QPoint)));
    dock->setWidget(m_recommendationView);
    addDockWidget(Qt::RightDockWidgetArea,dock);

    //TODO::if locked -> do this
    //dock->setFeatures(QDockWidget::NoDockWidgetFeatures);

    dock = new QDockWidget(i18n("Linked Resources"),this);
    dock->setAllowedAreas(Qt::RightDockWidgetArea);
    m_linkedResourceView = new QListView(dock);
    m_linkedResourceView->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(m_linkedResourceView,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(slotLinkedResourceContextMenu(QPoint)));

    dock->setWidget(m_linkedResourceView);
    addDockWidget(Qt::RightDockWidgetArea,dock);

    dock = new QDockWidget("",this);
    dock->setAllowedAreas(Qt::LeftDockWidgetArea);
    QWidget* buttonWidget = new QWidget(dock);
    QVBoxLayout* buttonLayout = new QVBoxLayout(buttonWidget);
    m_manualLinkResourceButton = new QPushButton(buttonWidget);
    m_manualLinkResourceButton->setIcon(KIcon("insert-link"));
    m_manualLinkResourceButton->setText(i18n("Link resources manually"));
    m_manualLinkResourceButton->setEnabled(false);
    m_manualLinkResourceButton->setFlat(true);
    connect(m_manualLinkResourceButton,SIGNAL(clicked()),this,SLOT(slotManualLinkResources()));
    m_removeDuplicateButton = new QPushButton(buttonWidget);
    m_removeDuplicateButton->setIcon(KIcon("archive-remove"));
    m_removeDuplicateButton->setText(i18n("Remove Duplicates"));
    m_removeDuplicateButton->setFlat(true);
    connect(m_removeDuplicateButton, SIGNAL(clicked()), this, SLOT(slotRemoveDuplicates()));

    m_autoTopicButton = new QPushButton(buttonWidget);
    m_autoTopicButton->setIcon(KIcon("nepomuk"));
    m_autoTopicButton->setText(i18n("Automatic Topic"));
    m_autoTopicButton->setFlat(true);
    connect(m_autoTopicButton, SIGNAL(clicked()), this, SLOT(slotAutomaticTopic()));

    buttonLayout->addWidget(m_manualLinkResourceButton);
    buttonLayout->addWidget(m_removeDuplicateButton);
    buttonLayout->addWidget(m_autoTopicButton);
    dock->setWidget(buttonWidget);
    dock->setFeatures(QDockWidget::NoDockWidgetFeatures);
    addDockWidget(Qt::LeftDockWidgetArea,dock);

    dock = new QDockWidget(i18n("Resource Search "),this);
    Nepomuk::Utils::FacetWidget *searchWidget = new Nepomuk::Utils::FacetWidget(dock);
    searchWidget->addFacet(Nepomuk::Utils::Facet::createDateFacet(searchWidget));
    searchWidget->addFacet(Nepomuk::Utils::Facet::createTypeFacet(searchWidget));
    searchWidget->addFacet(Nepomuk::Utils::Facet::createRatingFacet(searchWidget));
    searchWidget->addFacet(Nepomuk::Utils::Facet::createPriorityFacet(searchWidget));
    searchWidget->addFacet(Nepomuk::Utils::Facet::createTagFacet(searchWidget));
    connect(searchWidget,SIGNAL(queryTermChanged(Nepomuk::Query::Term)),this,SLOT(slotFilterApplied(Nepomuk::Query::Term)));
    dock->setWidget(searchWidget);
    addDockWidget(Qt::LeftDockWidgetArea,dock);
    dock->setFeatures(QDockWidget::NoDockWidgetFeatures);
    connect (this, SIGNAL( sigShowProperties(KUrl) ), this, SLOT( slotShowProperties(KUrl)));

}
开发者ID:phalgun,项目名称:RepontiK,代码行数:65,代码来源:resourcebrowser.cpp

示例15: QMdiArea

    void CockpitWindow::constructLayout() {
        // Setup an MDI application.
        m_cockpitArea = new QMdiArea(this);

        m_fileMenu = menuBar()->addMenu(tr("&File"));
        m_fileMenu->addSeparator();
        QAction *closeAction = new QAction(tr("&Close"), this);
        closeAction->setShortcut(tr("Ctrl+Q"));
        closeAction->setToolTip("Close the application.");
        connect(closeAction, SIGNAL(triggered()), this, SLOT(close()));
        m_fileMenu->addAction(closeAction);

        m_windowMenu = menuBar()->addMenu(tr("&Window"));
        QAction* cascadeSWAct = new QAction(tr("C&ascade"), this);
        cascadeSWAct->setShortcut(tr("Ctrl+F9"));
        cascadeSWAct->setToolTip(tr("Cascade all open monitors."));
        connect(cascadeSWAct, SIGNAL(triggered()), m_cockpitArea, SLOT(cascadeSubWindows()));
        m_windowMenu->addAction(cascadeSWAct);

        QAction* tileSWAct = new QAction(tr("&Tile"), this);
        tileSWAct->setShortcut(tr("Ctrl+F10"));
        tileSWAct->setToolTip(tr("Tile all open monitors."));
        connect(tileSWAct, SIGNAL(triggered()), m_cockpitArea, SLOT(tileSubWindows()));

        m_windowMenu->addAction(tileSWAct);
        m_windowMenu->addSeparator();
        QAction* maxSWAction = new QAction(tr("Ma&ximize"), this);
        maxSWAction->setShortcut(tr("Ctrl+F11"));
        maxSWAction->setToolTip(tr("Maximize current monitor."));
        connect(maxSWAction, SIGNAL(triggered()), SLOT(maximizeActiveSubWindow()));

        m_windowMenu->addAction(maxSWAction);
        QAction* minSWAction = new QAction(tr("M&inimize"), this);
        minSWAction->setShortcut(tr("Ctrl+F12"));
        minSWAction->setToolTip(tr("Minimize current monitor."));
        connect(minSWAction, SIGNAL(triggered()), SLOT(minimizeActiveSubWindow()));

        m_windowMenu->addAction(minSWAction);
        QAction* resetSWAction = new QAction(tr("&Reset"), this);
        resetSWAction->setShortcut(tr("Ctrl+Shift+F12"));
        resetSWAction->setToolTip(tr("Reset current monitor."));
        connect(resetSWAction, SIGNAL(triggered()), SLOT(resetActiveSubWindow()));

        m_windowMenu->addAction(resetSWAction);
        QAction* closeSWAction = new QAction(tr("&Close"), this);
        closeSWAction->setShortcut(tr("Ctrl+C"));
        closeSWAction->setToolTip(tr("Close current monitor."));
        connect(closeSWAction, SIGNAL(triggered()), m_cockpitArea , SLOT(closeActiveSubWindow()));

        m_windowMenu->addAction(closeSWAction);
        QAction* closeAllSWAction = new QAction(tr("Close &all"), this);
        closeAllSWAction->setShortcut(tr("Ctrl+Shift+C"));
        closeAllSWAction->setToolTip(tr("Close all monitors."));
        connect(closeAllSWAction, SIGNAL(triggered()), m_cockpitArea, SLOT(closeAllSubWindows()));
        m_windowMenu->addAction(closeAllSWAction);

        // Load available plugins.
        m_availablePlugInsList = new QListWidget(this);
        m_availablePlugInsList->setMaximumWidth(200);
        m_availablePlugInsList->setMinimumWidth(200);
        connect(m_availablePlugInsList, SIGNAL(itemDoubleClicked(QListWidgetItem*)), SLOT(showPlugIn(QListWidgetItem*)));

        // Query PlugInProvider for available plugins.
        vector<string> listOfAvailablePlugins = m_plugInProvider.getListOfAvailablePlugIns();
        vector<string>::iterator it = listOfAvailablePlugins.begin();
        while (it != listOfAvailablePlugins.end()) {
            QListWidgetItem *item = new QListWidgetItem(m_availablePlugInsList);
            item->setText((*it).c_str());
            item->setToolTip(m_plugInProvider.getDescriptionForPlugin((*it)).c_str());
            it++;
        }

        QDockWidget *dockWidget = new QDockWidget(tr("Plugins"), this);
        dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea |
                                    Qt::RightDockWidgetArea);
        dockWidget->setWidget(m_availablePlugInsList);
        addDockWidget(Qt::LeftDockWidgetArea, dockWidget);

        setCentralWidget(m_cockpitArea);

        m_multiplexer->start();
    }
开发者ID:romanimm,项目名称:OpenDaVINCI,代码行数:82,代码来源:CockpitWindow.cpp


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