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


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

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


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

示例1: setOrientation

void TabBarWidget::setOrientation(Qt::DockWidgetArea orientation)
{
	switch (orientation)
	{
		case Qt::LeftDockWidgetArea:
			setShape(QTabBar::RoundedWest);

			break;
		case Qt::RightDockWidgetArea:
			setShape(QTabBar::RoundedEast);

			break;
		case Qt::BottomDockWidgetArea:
			setShape(QTabBar::RoundedSouth);

			break;
		default:
			setShape(QTabBar::RoundedNorth);

			break;
	}

	QDockWidget *widget = qobject_cast<QDockWidget*>(parentWidget()->parentWidget());

	if (widget)
	{
		if (orientation == Qt::LeftDockWidgetArea || orientation == Qt::RightDockWidgetArea)
		{
			widget->setFeatures(widget->features() & ~QDockWidget::DockWidgetVerticalTitleBar);
		}
		else
		{
			widget->setFeatures(widget->features() | QDockWidget::DockWidgetVerticalTitleBar);
		}
	}

	QBoxLayout *layout = qobject_cast<QBoxLayout*>(parentWidget()->layout());

	if (layout)
	{
		if (orientation == Qt::LeftDockWidgetArea || orientation == Qt::RightDockWidgetArea)
		{
			layout->setDirection(QBoxLayout::TopToBottom);
		}
		else
		{
			layout->setDirection(QBoxLayout::LeftToRight);
		}
	}
}
开发者ID:wanarek,项目名称:otter,代码行数:50,代码来源:TabBarWidget.cpp

示例2: setLocked

void KoDockWidgetTitleBar::setLocked(bool locked)
{
    QDockWidget *q = qobject_cast<QDockWidget*>(parentWidget());

    d->locked = locked;
    d->lockButton->blockSignals(true);
    d->lockButton->setChecked(locked);
    d->lockButton->blockSignals(false);

    //qDebug() << "setlocked" << q << d->locked << locked;

    if (locked) {
        d->features = q->features();
        q->setFeatures(QDockWidget::NoDockWidgetFeatures);
    }
    else {
        q->setFeatures(d->features);
    }

    q->toggleViewAction()->setEnabled(!locked);
    d->closeButton->setEnabled(!locked);
    d->floatButton->setEnabled(!locked);
    d->collapseButton->setEnabled(!locked);

    d->updateIcons();
    q->setProperty("Locked", locked);
    resizeEvent(0);
}
开发者ID:ChrisJong,项目名称:krita,代码行数:28,代码来源:KoDockWidgetTitleBar.cpp

示例3: minimumSizeHint

QSize TitleBar::minimumSizeHint() const
{
	QDockWidget *dw = qobject_cast<QDockWidget*>(parentWidget());
	Q_ASSERT(dw != 0);
	QSize result(rightPm.width(), centerPm.height());
	if (dw->features() & QDockWidget::DockWidgetVerticalTitleBar)
		result.transpose();
	return result;
}
开发者ID:CheeryLee,项目名称:QShaderEditor,代码行数:9,代码来源:titlebar.cpp

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

示例5: blockFloating

void QxFileBrowser::blockFloating(bool on)
{
	#ifdef Q_WS_MAC
	#ifdef QT_MAC_USE_COCOA
	QDockWidget* dock = qobject_cast<QDockWidget*>(parentWidget());
	if (dock) {
		QFlags<QDockWidget::DockWidgetFeature> flags = dock->features();
		if (on)
			flags &= ~QDockWidget::DockWidgetMovable;
		else
			flags |= QDockWidget::DockWidgetMovable;
		dock->setFeatures(flags);
	}
	#endif // QT_MAC_USE_COCOA
	#endif // Q_WS_MAC
}
开发者ID:corelon,项目名称:paco,代码行数:16,代码来源:QxFileBrowser.cpp

示例6: QVERIFY

void tst_QDockWidget::taskQTBUG_1665_closableChanged()
{
    QDockWidget dock;
    dock.show();
    QVERIFY(QTest::qWaitForWindowExposed(&dock));

    QDockWidgetLayout *l = qobject_cast<QDockWidgetLayout*>(dock.layout());

    if (l && !l->nativeWindowDeco())
        QSKIP("this machine doesn't support native dock widget");

    QVERIFY(dock.windowFlags() & Qt::WindowCloseButtonHint);

    //now let's remove the closable attribute
    dock.setFeatures(dock.features() ^ QDockWidget::DockWidgetClosable);
    QVERIFY(!(dock.windowFlags() & Qt::WindowCloseButtonHint));
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:17,代码来源:tst_qdockwidget.cpp

示例7: sets

WindowImpl::WindowImpl():
    m_ui(new Ui::WindowImpl)
{
    m_ui->setupUi(this);
    QApplication::setStyle(new QNotoStyle);

    QSettings sets(QSettings::IniFormat, QSettings::UserScope, "qnoto", "qnoto");
    restoreGeometry(sets.value("MainWindow/Geometry").toByteArray());

    QDockWidget *dockWidget = new QDockWidget("Left side", this);
    dockWidget->setContentsMargins(0, 0, 0, 0);
    dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea);
    dockWidget->setFloating(false);
    dockWidget->setFeatures(dockWidget->features() ^ QDockWidget::DockWidgetClosable ^ QDockWidget::DockWidgetMovable ^ QDockWidget::DockWidgetFloatable);
    dockWidget->setTitleBarWidget(new QWidget);
    m_split = new SideSplit(this);
    dockWidget->setWidget(m_split);
    addDockWidget(Qt::LeftDockWidgetArea, dockWidget);

    m_editors = qnoto::plugin<qnoto::Editors>();
    connect(m_editors, &qnoto::Editors::updateEditMenu, this, &WindowImpl::updateEditMenu);

    setCentralWidget(m_editors);

    const auto& acts = m_editors->actions();
    for(const auto& it: acts){
        if (it->property("name").toString().startsWith("File_")){
            m_ui->menuFile->addAction(it);
        }
        if (it->property("name").toString().startsWith("Window_")){
            m_ui->menuWindow->addAction(it);
        }
    }

    connect(m_ui->actionPreferences, &QAction::triggered, this, &WindowImpl::showPreferences);

    m_split->restoreState(sets);
    m_editors->restoreState();
}
开发者ID:shujaatak,项目名称:qnoto,代码行数:39,代码来源:window-impl.cpp

示例8: 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()];
    }

    KConfigGroup group(KSharedConfig::openConfig(), "GUI");
    QFont dockWidgetFont  = QFontDatabase::systemFont(QFontDatabase::GeneralFont);
    qreal pointSize = group.readEntry("palettefontsize", dockWidgetFont.pointSize() * 0.75);
    pointSize = qMax(pointSize, QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont).pointSizeF());
    dockWidgetFont.setPointSizeF(pointSize);
#ifdef Q_WS_MAC
    dockWidget->setAttribute(Qt::WA_MacSmallSize, true);
#endif
    dockWidget->setFont(dockWidgetFont);

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

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

示例9: features

void tst_QDockWidget::features()
{
    QDockWidget dw;

    QSignalSpy spy(&dw, SIGNAL(featuresChanged(QDockWidget::DockWidgetFeatures)));

    // default features for dock widgets
    int allDockWidgetFeatures = QDockWidget::DockWidgetClosable |
                                QDockWidget::DockWidgetMovable  |
                                QDockWidget::DockWidgetFloatable;

    // defaults
    QCOMPARE(dw.features(), allDockWidgetFeatures);
    QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetClosable));
    QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetMovable));
    QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetFloatable));

    // test individual setting
    setFeature(&dw, QDockWidget::DockWidgetClosable, false);
    QCOMPARE(dw.features(), QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
    QVERIFY(!hasFeature(&dw, QDockWidget::DockWidgetClosable));
    QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetMovable));
    QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetFloatable));
    QCOMPARE(spy.count(), 1);
    QCOMPARE((int)*(static_cast<const QDockWidget::DockWidgetFeature *>(spy.at(0).value(0).constData())),
            (int)dw.features());
    spy.clear();
    dw.setFeatures(dw.features());
    QCOMPARE(spy.count(), 0);
    spy.clear();

    setFeature(&dw, QDockWidget::DockWidgetClosable);
    QCOMPARE(dw.features(), allDockWidgetFeatures);
    QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetClosable));
    QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetMovable));
    QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetFloatable));
    QCOMPARE(spy.count(), 1);
    QCOMPARE((int)*static_cast<const QDockWidget::DockWidgetFeature *>(spy.at(0).value(0).constData()),
            (int)dw.features());
    spy.clear();
    dw.setFeatures(dw.features());
    QCOMPARE(spy.count(), 0);
    spy.clear();

    setFeature(&dw, QDockWidget::DockWidgetMovable, false);
    QCOMPARE(dw.features(), QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable);
    QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetClosable));
    QVERIFY(!hasFeature(&dw, QDockWidget::DockWidgetMovable));
    QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetFloatable));
    QCOMPARE(spy.count(), 1);
    QCOMPARE((int)*static_cast<const QDockWidget::DockWidgetFeature *>(spy.at(0).value(0).constData()),
            (int)dw.features());
    spy.clear();
    dw.setFeatures(dw.features());
    QCOMPARE(spy.count(), 0);
    spy.clear();

    setFeature(&dw, QDockWidget::DockWidgetMovable);
    QCOMPARE(dw.features(), allDockWidgetFeatures);
    QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetClosable));
    QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetMovable));
    QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetFloatable));
    QCOMPARE(spy.count(), 1);
    QCOMPARE((int)*static_cast<const QDockWidget::DockWidgetFeature *>(spy.at(0).value(0).constData()),
            (int)dw.features());
    spy.clear();
    dw.setFeatures(dw.features());
    QCOMPARE(spy.count(), 0);
    spy.clear();

    setFeature(&dw, QDockWidget::DockWidgetFloatable, false);
    QCOMPARE(dw.features(), QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable);
    QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetClosable));
    QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetMovable));
    QVERIFY(!hasFeature(&dw, QDockWidget::DockWidgetFloatable));
    QCOMPARE(spy.count(), 1);
    QCOMPARE((int)*static_cast<const QDockWidget::DockWidgetFeature *>(spy.at(0).value(0).constData()),
            (int)dw.features());
    spy.clear();
    dw.setFeatures(dw.features());
    QCOMPARE(spy.count(), 0);
    spy.clear();

    setFeature(&dw, QDockWidget::DockWidgetFloatable);
    QCOMPARE(dw.features(), allDockWidgetFeatures);
    QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetClosable));
    QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetMovable));
    QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetFloatable));
    QCOMPARE(spy.count(), 1);
    QCOMPARE((int)*static_cast<const QDockWidget::DockWidgetFeature *>(spy.at(0).value(0).constData()),
            (int)dw.features());
    spy.clear();
    dw.setFeatures(dw.features());
    QCOMPARE(spy.count(), 0);
    spy.clear();

    // set all at once
    dw.setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable);
    QCOMPARE(dw.features(), QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable);
    QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetClosable));
//.........这里部分代码省略.........
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:101,代码来源:tst_qdockwidget.cpp

示例10: 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

示例11: createDockWidgets

/*!
 * INIT: create dock widgets.
 */
void socketcangui::createDockWidgets() {
  // Send widget (table; normally in the lower part)
  QWidget *sendwidget = new QWidget;
  QHBoxLayout *sendwidgetLayout = new QHBoxLayout;
  sendtable = new QTreeWidget;
  sendtable->setColumnCount(6);
  sendtable->setAlternatingRowColors(true);
  sendtable->setHeaderLabels(QStringList() << tr("#") << tr("Interval (ms)") << tr("CAN ID (hex)") << tr("EFF") << tr("DLC") << tr("Data (hex)") << tr("Active"));
  timerdisplaylist.clear();
  QString tmpstring;
  // insert ten send rows
  for (int i = 0; i < 10; i++) {
    tmpstring = QString::number(i);
    timerdisplaylist.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList() << tmpstring << "0" << "0" << "0" << "0" << "0" << "0"));
    // make the row editable
    timerdisplaylist.at(i)->setFlags(timerdisplaylist.at(i)->flags() | Qt::ItemIsEditable);
  }
  sendtable->addTopLevelItems(timerdisplaylist);
  // create the ten send timers
  for (int i = 0; i < 10; i++) {
    timerlist[i] = new QTimer;
  }
  // Really ugly but the timeout()-SIGNAL won't tell us which timer it was
  connect(timerlist[0], SIGNAL(timeout()), this, SLOT(sendtimer0fired()));
  connect(timerlist[1], SIGNAL(timeout()), this, SLOT(sendtimer1fired()));
  connect(timerlist[2], SIGNAL(timeout()), this, SLOT(sendtimer2fired()));
  connect(timerlist[3], SIGNAL(timeout()), this, SLOT(sendtimer3fired()));
  connect(timerlist[4], SIGNAL(timeout()), this, SLOT(sendtimer4fired()));
  connect(timerlist[5], SIGNAL(timeout()), this, SLOT(sendtimer5fired()));
  connect(timerlist[6], SIGNAL(timeout()), this, SLOT(sendtimer6fired()));
  connect(timerlist[7], SIGNAL(timeout()), this, SLOT(sendtimer7fired()));
  connect(timerlist[8], SIGNAL(timeout()), this, SLOT(sendtimer8fired()));
  connect(timerlist[9], SIGNAL(timeout()), this, SLOT(sendtimer9fired()));
  connect(sendtable, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(sendtablechanged(QTreeWidgetItem *, int)));

  sendwidgetLayout->addWidget(sendtable);
  sendwidget->setMinimumHeight(100);
  sendwidget->setLayout(sendwidgetLayout);
  QDockWidget *sendwidgetDock = new QDockWidget(tr("Send packets"));
  sendwidgetDock->setWidget(sendwidget);
  addDockWidget(Qt::BottomDockWidgetArea, sendwidgetDock);
  // make the dock widget non-closeable
  sendwidgetDock->setFeatures(sendwidgetDock->features() & ~QDockWidget::DockWidgetClosable);

  // Control widget (normally on the right side)
  QWidget *controlwidget = new QWidget;
  QVBoxLayout *controlwidgetLayout = new QVBoxLayout;
  controlwidget->setLayout(controlwidgetLayout);
  QDockWidget *controlwidgetDock = new QDockWidget(tr("Capture control"));
  controlwidgetDock->setWidget(controlwidget);
  addDockWidget(Qt::RightDockWidgetArea, controlwidgetDock);
  // make the dock widget non-closeable
  controlwidgetDock->setFeatures(controlwidgetDock->features() & ~QDockWidget::DockWidgetClosable);

  QLabel *ifacelabel = new QLabel(tr("CAN Interfaces:"));
  QPushButton *updateifaces = new QPushButton(tr("Update"));
  QHBoxLayout *ifacesheader = new QHBoxLayout;
  ifacesheader->addWidget(ifacelabel);
  ifacesheader->addWidget(updateifaces);
  controlwidgetLayout->addLayout(ifacesheader);
  ifacelist = new QTreeWidget;
  ifacelist->setColumnCount(2);
  ifacelist->setHeaderLabels(QStringList() << tr("Interface") << tr("Status"));
  controlwidgetLayout->addWidget(ifacelist);
  connect(updateifaces, SIGNAL(clicked()), this, SLOT(updateinterfacelist()));
  connect(ifacelist, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(ifacelistdclicked(QModelIndex)));

  QHBoxLayout *capturelayout = new QHBoxLayout;
  controlwidgetLayout->addLayout(capturelayout);
  QLabel *capturelabel = new QLabel(tr("Capture Interface:"));
  capturelayout->addWidget(capturelabel);

  ifacecombo = new QComboBox;
  capturelayout->addWidget(ifacecombo);
  capturepb = new QPushButton(tr("Start"));
  capturelayout->addWidget(capturepb);

  // Tell Qt that canpacket can be used with SLOTs and SIGNALs
  qRegisterMetaType<canpacket>("canpacket");
  connect(capturepb, SIGNAL(clicked()), this, SLOT(startorstopthread()));
  connect(&mycanthread, SIGNAL(dataarrived(canpacket)), myclf, SLOT(adddataitem(canpacket)));

  // Tell Qt that threadstatus can be used with SLOTs and SIGNALs
  qRegisterMetaType<threadstatus>("threadstatus");
  connect(&mycanthread, SIGNAL(statusChanged(threadstatus)), this, SLOT(updateStatus(threadstatus)));

  // Status widget (normally on the right side)
  QWidget *statuswidget = new QWidget;
  QVBoxLayout *statuswidgetLayout = new QVBoxLayout;
  statuswidget->setLayout(statuswidgetLayout);
  statuswidgetDock = new QDockWidget(tr("Capture status"));
  statuswidgetDock->setWidget(statuswidget);
  addDockWidget(Qt::RightDockWidgetArea, statuswidgetDock);
  // make the dock widget non-closeable
  statuswidgetDock->setFeatures(statuswidgetDock->features() & ~QDockWidget::DockWidgetClosable);

  statusdisplaylabel = new QLabel(tr("Idle"));
//.........这里部分代码省略.........
开发者ID:kripton,项目名称:socketcangui,代码行数:101,代码来源:socketcangui.cpp


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