本文整理汇总了C++中QDockWidget::setFeatures方法的典型用法代码示例。如果您正苦于以下问题:C++ QDockWidget::setFeatures方法的具体用法?C++ QDockWidget::setFeatures怎么用?C++ QDockWidget::setFeatures使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDockWidget
的用法示例。
在下文中一共展示了QDockWidget::setFeatures方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createDockWidgets
void MainWindow::createDockWidgets()
{
setDockOptions(QMainWindow::AnimatedDocks);
QDockWidget::DockWidgetFeatures features =
QDockWidget::DockWidgetMovable|
QDockWidget::DockWidgetFloatable;
transformWidget = new TransformWidget;
QDockWidget *transformDockWidget = new QDockWidget(
tr("Transform"), this);
transformDockWidget->setFeatures(features);
transformDockWidget->setWidget(transformWidget);
addDockWidget(Qt::RightDockWidgetArea, transformDockWidget);
brushWidget = new BrushWidget;
QDockWidget *brushDockWidget = new QDockWidget(tr("Brush (Fill)"),
this);
brushDockWidget->setFeatures(features);
brushDockWidget->setWidget(brushWidget);
addDockWidget(Qt::RightDockWidgetArea, brushDockWidget);
penWidget = new PenWidget;
QDockWidget *penDockWidget = new QDockWidget(tr("Pen (Outline)"),
this);
penDockWidget->setFeatures(features);
penDockWidget->setWidget(penWidget);
addDockWidget(Qt::RightDockWidgetArea, penDockWidget);
}
示例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);
}
示例3: lockDocks
void DockHost::lockDocks(bool lock)
{
if (lock == lastLock)
return;
lastLock = lock;
Q_FOREACH (QWidget* widget, widgets)
{
QDockWidget* dock = static_cast<QDockWidget*>(widget->parentWidget());
if (dock)
{
if (lock)
{
if (dock->isFloating())
{
dock->setFeatures(QDockWidget::DockWidgetFloatable);
dock->setAllowedAreas(Qt::NoDockWidgetArea);
}
else
{
dock->setFeatures(QDockWidget::NoDockWidgetFeatures);
dock->setAllowedAreas(Qt::AllDockWidgetAreas);
}
}
else
{
dock->setFeatures(QDockWidget::AllDockWidgetFeatures);
dock->setAllowedAreas(Qt::AllDockWidgetAreas);
}
adjustFloatingWindowFlags(dock);
}
}
示例4: QMainWindow
Window::Window () : QMainWindow (NULL) {
try {
viewer = new GLViewer;
} catch (GLViewer::Exception e) {
cerr << e.getMessage () << endl;
exit (1);
}
setCentralWidget (viewer);
#if DEBUG
cout << "/ ! \\ Building in Debug mode. Performance will be impacted" << endl;
#else
viewer->setBaseSize(500, 500);
#endif
initControlWidget ();
QDockWidget * controlDockWidget = new QDockWidget (this);
controlDockWidget->setWidget (controlWidget);
controlDockWidget->adjustSize ();
addDockWidget (Qt::RightDockWidgetArea, controlDockWidget);
controlDockWidget->setFloating(true);
controlDockWidget->setFeatures (QDockWidget::AllDockWidgetFeatures);
controlDockWidget->adjustSize();
controlDockWidget->move(0, 0);
QDockWidget * focalDockWidget = new QDockWidget (this);
focalDockWidget->setWidget(focalWidget);
focalDockWidget->adjustSize ();
addDockWidget (Qt::LeftDockWidgetArea, focalDockWidget);
focalDockWidget->setFloating(true);
focalDockWidget->setFeatures (QDockWidget::AllDockWidgetFeatures);
focalDockWidget->adjustSize();
focalDockWidget->move(200, 0);
QDockWidget* rayTracerDockWidget = new QDockWidget(this);
rayTracerDockWidget->setWidget(rayTracerWidget);
rayTracerDockWidget->adjustSize ();
addDockWidget (Qt::TopDockWidgetArea, rayTracerDockWidget);
rayTracerDockWidget->setFloating(true);
rayTracerDockWidget->setFeatures (QDockWidget::AllDockWidgetFeatures);
rayTracerDockWidget->adjustSize();
// Move widgets around the raytracer
QDesktopWidget desktop;
QRect mainScreenSize = desktop.availableGeometry(desktop.primaryScreen());
controlDockWidget->move(mainScreenSize.width() - 200, 0);
rayTracerDockWidget->move(0, 0);
focalDockWidget->move(0, mainScreenSize.height() - focalDockWidget->height());
statusBar()->showMessage("");
}
示例5: 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);
}
}
}
示例6: QMainWindow
KinectRecorderWindow::KinectRecorderWindow(int fps, KinectDevice* device)
: QMainWindow()
, fps_(fps)
, device_(device)
, widget_viewer_(new KinectViewerWidget(fps, device))
{
widget_viewer_->setMinimumSize(1280, 480);
widget_viewer_->setMaximumSize(1280, 480);
setCentralWidget(widget_viewer_);
QDockWidget *dock = new QDockWidget(this);
dock->setAllowedAreas(Qt::BottomDockWidgetArea);
dock->setFeatures(QDockWidget::NoDockWidgetFeatures);
widget_record_ = new RecordInterfaceWidget(dock);
connect(widget_record_, SIGNAL(dialogOpened()), widget_viewer_, SLOT(pause()));
connect(widget_record_, SIGNAL(dialogClosed()), widget_viewer_, SLOT(resume()));
connect(widget_record_, SIGNAL(destroyed(QObject*)), this, SLOT(close()));
connect(widget_record_, SIGNAL(startRecord(std::string)), this, SLOT(recordStarted(std::string)));
connect(widget_record_, SIGNAL(finishRecord()), this, SLOT(recordFinished()));
widget_record_->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
dock->setWidget(widget_record_);
addDockWidget(Qt::BottomDockWidgetArea, dock);
setWindowTitle("Kinect viewer");
move(100, 100);
setAttribute(Qt::WA_DeleteOnClose);
}
示例7: 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;
}
示例8: createDock
void MainWindow::createDock()
{
QDockWidget* dock = new QDockWidget("", this);
dock->setAllowedAreas(Qt::TopDockWidgetArea);
dock->setFeatures(QDockWidget::NoDockWidgetFeatures);
QLabel *roundNumTitle = new QLabel("Round #:");
rndNum = new QLabel(QString::number(0));
QLabel *tarRemTitle = new QLabel("Targets Remaining:");
tarRem = new QLabel(QString::number(0));
QLabel *errorNumTitle = new QLabel("Errors:");
errorNum = new QLabel(QString::number(0));
QWidget *parentWidget = new QWidget();
QHBoxLayout *layout = new QHBoxLayout();
layout->addWidget(roundNumTitle);
layout->addWidget(rndNum);
layout->addStretch();
layout->addWidget(tarRemTitle);
layout->addWidget(tarRem);
layout->addStretch();
layout->addWidget(errorNumTitle);
layout->addWidget(errorNum);
parentWidget->setLayout(layout);
dock->setWidget(parentWidget);
addDockWidget(Qt::TopDockWidgetArea, dock);
}
示例9: QDialog
/**
* Constructs a DlgDisplayPropertiesImp which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*
* The dialog will by default be modeless, unless you set 'modal' to
* true to construct a modal dialog.
*/
DlgDisplayPropertiesImp::DlgDisplayPropertiesImp( QWidget* parent, Qt::WindowFlags fl )
: QDialog( parent, fl )
{
this->setupUi(this);
textLabel1_3->hide();
changePlot->hide();
buttonLineColor->setModal(false);
buttonColor->setModal(false);
std::vector<Gui::ViewProvider*> views = getSelection();
setDisplayModes(views);
fillupMaterials();
setMaterial(views);
setColorPlot(views);
setShapeColor(views);
setLineColor(views);
setPointSize(views);
setLineWidth(views);
setTransparency(views);
setLineTransparency(views);
// embed this dialog into a dockable widget container
Gui::DockWindowManager* pDockMgr = Gui::DockWindowManager::instance();
QDockWidget* dw = pDockMgr->addDockWindow("Display properties", this, Qt::AllDockWidgetAreas);
dw->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable);
dw->setFloating(true);
dw->show();
Gui::Selection().Attach(this);
this->connectChangedObject =
Gui::Application::Instance->signalChangedObject.connect(boost::bind
(&DlgDisplayPropertiesImp::slotChangedObject, this, _1, _2));
}
示例10: QDialog
DownloadManager::DownloadManager(QWidget *parent)
: QDialog(parent)
, m_autoSaver(new AutoSaver(this))
, m_manager(new NetworkAccessManager(this))
, m_iconProvider(0)
, m_removePolicy(Never)
, ui(new Ui_DownloadManager())
{
ui->setupUi(this);
ui->downloadsView->setShowGrid(false);
ui->downloadsView->verticalHeader()->hide();
ui->downloadsView->horizontalHeader()->hide();
ui->downloadsView->setAlternatingRowColors(true);
ui->downloadsView->horizontalHeader()->setStretchLastSection(true);
m_model = new DownloadModel(this);
ui->downloadsView->setModel(m_model);
connect(ui->cleanupButton, SIGNAL(clicked()), this, SLOT(cleanup()));
load();
Gui::DockWindowManager* pDockMgr = Gui::DockWindowManager::instance();
QDockWidget* dw = pDockMgr->addDockWindow(QT_TR_NOOP("Download Manager"),
this, Qt::BottomDockWidgetArea);
dw->setFeatures(QDockWidget::DockWidgetMovable|
QDockWidget::DockWidgetFloatable|
QDockWidget::DockWidgetClosable);
dw->setAttribute(Qt::WA_DeleteOnClose);
dw->show();
}
示例11: dockVisibilityChanged
// Workaround for bug on Mac: If all docks are hidden,
// it's not possible to open the dock menu and show them again
void MainWindow::dockVisibilityChanged(bool v)
{
// A dock got visible: make all of them closable
if(v)
{
for(auto dock : docks)
dock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
return;
}
// All but one dock hidden?
QDockWidget *remaining = nullptr;
for(auto dock : docks)
if(dock->isVisible())
{
if(remaining)
return; // Enough docks visible
else
remaining = dock;
}
if(!remaining)
return; // No dock visible?
// Disable closability on the remaining one
remaining->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
}
示例12: AddressInput
MainWindow::MainWindow()
{
AddressInput* addressInput = new AddressInput( this );
this->addToolBar( addressInput );
QDockWidget* motor0Dock = new QDockWidget( "Motor 0", this );
motor0Dock->setWidget( new MotorWidget( this, 0 ) );
motor0Dock->setFeatures( QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable );
addDockWidget(Qt::BottomDockWidgetArea, motor0Dock );
motor0Dock->setFloating( false );
motor0Dock->setVisible( true );
QDockWidget* motor1Dock = new QDockWidget( "Motor 1", this );
motor1Dock->setWidget( new MotorWidget( this, 1 ) );
motor1Dock->setFeatures( QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable );
addDockWidget(Qt::BottomDockWidgetArea, motor1Dock );
motor1Dock->setFloating( false );
motor1Dock->setVisible( true );
QDockWidget* motor2Dock = new QDockWidget( "Motor 2", this );
motor2Dock->setWidget( new MotorWidget( this, 2 ) );
motor2Dock->setFeatures( QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable );
addDockWidget(Qt::BottomDockWidgetArea, motor2Dock );
motor2Dock->setFloating( false );
motor2Dock->setVisible( true );
QDockWidget* odometryDock = new QDockWidget( "Odometry", this );
odometryDock->setWidget( new OdometryWidget( this ) );
odometryDock->setFeatures( QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable );
addDockWidget(Qt::BottomDockWidgetArea, odometryDock );
odometryDock->setFloating( false );
odometryDock->setVisible( true );
setCentralWidget( new ControlPanelWidget( this ) );
}
示例13: Placement
DockablePlacement::DockablePlacement(QWidget* parent, Qt::WFlags fl) : Placement(parent, fl)
{
Gui::DockWindowManager* pDockMgr = Gui::DockWindowManager::instance();
QDockWidget* dw = pDockMgr->addDockWindow(QT_TR_NOOP("Placement"),
this, Qt::BottomDockWidgetArea);
dw->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable);
dw->show();
}
示例14: 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;
}
示例15: 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());
}