本文整理汇总了C++中QDockWidget::setVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ QDockWidget::setVisible方法的具体用法?C++ QDockWidget::setVisible怎么用?C++ QDockWidget::setVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDockWidget
的用法示例。
在下文中一共展示了QDockWidget::setVisible方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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() );
}
示例2: 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 ) );
}
示例3: closeProject
void PogadeMainWindow::closeProject() {
//TODO: finish it
QListIterator<QDockWidget*> i(_dockSourceEditorList);
while (i.hasNext()) {
PogadeSourceCodeEditor* w = (PogadeSourceCodeEditor*) i.next()->widget();
bool saveall = false;
//TODO: check changed and ask user
if(w->fileChanged()) {
if(saveall) {
w->saveFile();
}
else {
QMessageBox msgBox;
msgBox.setText(tr("The File %1 revision %2 ( %3 ) has been modified and not saved").arg(w->sourceFile()->name()).arg(w->sourceFile()->getRevInUse()).arg(w->sourceFile()->getRevisionName(w->sourceFile()->getRevInUse())));
msgBox.setInformativeText(tr("Do you want to save your changes before changing revision?"));
msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::SaveAll | QMessageBox::Discard | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::SaveAll);
int ret = msgBox.exec();
switch (ret) {
case QMessageBox::SaveAll:
saveall = true;
case QMessageBox::Save:
w->saveFile();
break;
case QMessageBox::Discard:
break;
case QMessageBox::Cancel:
return;
break;
default:
// should never be reached
break;
}
}
}
}
//TODO: clean the project stuff
_dockProjectViewer->setVisible(false);
delete _dockProjectViewer->widget();
delete _dockProjectViewer;
_dockProjectViewer = nullptr;
while(!_dockSourceEditorList.isEmpty()) {
QDockWidget* dock = _dockSourceEditorList.takeFirst();
dock->setVisible(false);
PogadeSourceCodeEditor* w = (PogadeSourceCodeEditor*) dock->widget();
delete w;
}
_dockSourceEditorList.clear();
_allCorrect = true;
_validProject = false;
delete _project;
_project = nullptr;
this->setUpProject();
}
示例4: pluginsDir
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
SettingsObserver(Settings::Category::Layout),
ui(new Ui::MainWindow),
m_treeView(0),
m_graphicsItemView(0),
m_graphicsScene(0),
m_proxyModel(0),
m_model(0),
m_addSymbolsDialog(0),
m_aboutDialog(0),
m_settingsDialog(0),
m_smuflLoader(0),
m_commonApplication(0)
{
ui->setupUi(this);
m_commonApplication = new CommonApplication();
m_sharedApplication = Application(m_commonApplication);
LayoutSettings::registerObserver(this);
QDir pluginsDir(QCoreApplication::applicationDirPath());
if (!pluginsDir.exists(pluginsDirName)) {
pluginsDir.mkdir(pluginsDirName);
}
pluginsDir.cd(pluginsDirName);
initMusicFont();
m_addSymbolsDialog = new AddSymbolsDialog(this);
m_aboutDialog = new AboutDialog(this);
m_settingsDialog = new SettingsDialog(this);
CommonPluginManager *pluginManager = new CommonPluginManager(pluginsDir);
m_pluginManager = PluginManager(pluginManager);
pluginManager->setSharedPluginManager(m_pluginManager);
pluginManager->setMusicFont(m_musicFont);
createModelAndView();
createMenusAndToolBars();
createAndPopulateSymbolPalettes();
createConnections();
// Show at least first instrument palette
if (m_pluginManager->instrumentNames().count()) {
QString instrumentName = m_pluginManager->instrumentNames().at(0);
QDockWidget *instrumentDock = m_symbolDockWidgets.value(instrumentName);
if (instrumentDock) {
instrumentDock->setVisible(true);
}
}
createObjectNames();
setWindowTitle(tr("%1 [*]")
.arg(QApplication::applicationName()));
updateUi();
}
示例5: createModelAndView
void MainWindow::createModelAndView()
{
m_treeView = new TreeView(this);
m_treeView->setPluginManager(m_pluginManager);
QDockWidget *treeViewDock = new QDockWidget("Tree View", this);
treeViewDock->setWidget(m_treeView);
treeViewDock->setWindowTitle("Tree View");
addDockWidget(Qt::RightDockWidgetArea, treeViewDock);
treeViewDock->setVisible(false);
connect(ui->viewTreeViewAction, &QAction::triggered,
[this, treeViewDock] (bool checked) {
treeViewDock->setVisible(checked);
});
connect(treeViewDock, &QDockWidget::visibilityChanged,
[this] (bool visible) {
ui->viewTreeViewAction->setChecked(visible);
});
m_graphicsItemView = new GraphicsItemView(this);
m_graphicsItemView->setPluginManager(m_pluginManager);
m_graphicsItemView->setApplication(m_sharedApplication);
MusicModel *musicModel = new MusicModel(this);
musicModel->setPluginManager(m_pluginManager);
m_model = musicModel;
MusicProxyModel *proxyModel = new MusicProxyModel(this);
proxyModel->setPluginManager(m_pluginManager);
proxyModel->setSourceModel(m_model);
m_proxyModel = proxyModel;
m_treeView->setModel(m_proxyModel);
m_graphicsItemView->setModel(m_model);
setCentralWidget(m_graphicsItemView);
}
示例6: showDialog
void ControlSingleton::showDialog(Gui::TaskView::TaskDialog *dlg)
{
// only one dialog at a time
assert(!ActiveDialog || ActiveDialog==dlg);
Gui::DockWnd::CombiView* pcCombiView = qobject_cast<Gui::DockWnd::CombiView*>
(Gui::DockWindowManager::instance()->getDockWindow("Combo View"));
// should return the pointer to combo view
if (pcCombiView) {
pcCombiView->showDialog(dlg);
// make sure that the combo view is shown
QDockWidget* dw = qobject_cast<QDockWidget*>(pcCombiView->parentWidget());
if (dw) {
dw->setVisible(true);
dw->toggleViewAction()->setVisible(true);
dw->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable);
}
if (ActiveDialog == dlg)
return; // dialog is already defined
ActiveDialog = dlg;
connect(dlg, SIGNAL(destroyed()), this, SLOT(closedDialog()));
}
// not all workbenches have the combo view enabled
else if (!_taskPanel) {
QDockWidget* dw = new QDockWidget();
dw->setWindowTitle(tr("Task panel"));
dw->setFeatures(QDockWidget::DockWidgetMovable);
_taskPanel = new Gui::TaskView::TaskView(dw);
dw->setWidget(_taskPanel);
_taskPanel->showDialog(dlg);
getMainWindow()->addDockWidget(Qt::LeftDockWidgetArea, dw);
connect(dlg, SIGNAL(destroyed()), dw, SLOT(deleteLater()));
// if we have the normal tree view available then just tabify with it
QWidget* treeView = Gui::DockWindowManager::instance()->getDockWindow("Tree view");
QDockWidget* par = treeView ? qobject_cast<QDockWidget*>(treeView->parent()) : 0;
if (par && par->isVisible()) {
getMainWindow()->tabifyDockWidget(par, dw);
qApp->processEvents(); // make sure that the task panel is tabified now
dw->show();
dw->raise();
}
}
}
示例7: glRectF
void QStaticWidgetSwitchable3D::beforeOpen()
{
m_StaticImage = QPixmap(m_pWidget->size()/*, QImage::Format_RGB32*/);
if(!m_pWidget->isVisible())
{
m_pWidget->show();
m_pWidget->hide();
}
m_pWidget->render(&m_StaticImage);
m_pOwner->setFocus();
/*QGLWidget* qgl = NULL;
Q_FOREACH(qgl, m_QGLWidgetsToRender)
{
if(qgl->isVisible())
{
QWidget* parent = (QWidget*)m_pOwner;
QPoint screenQGLCoords = qgl->mapTo(m_pWidget, QPoint(0,0));
float w = float(qgl->width());
float h = float(qgl->height());
QRectF glRectF(0,0,w,h);
QPainter painter(&m_StaticImage);
painter.drawImage(glRectF, qgl->grabFrameBuffer(true));
}
}*/
if(m_pWidget->inherits("QMainWindow"))
{
QMainWindow* pMainWindow = (QMainWindow*)m_pWidget;
QList<QDockWidget*> docks = pMainWindow->findChildren<QDockWidget*>();
QDockWidget* dock = NULL;
Q_FOREACH(dock, docks)
{
if(dock->isFloating() && !dock->isHidden())
{
if(!m_FloatingVisibleDockWidgets.contains(dock))
{
m_FloatingVisibleDockWidgets.append(dock);
dock->setVisible(false);
}
}
}
}
示例8: pixmap
//.........这里部分代码省略.........
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);
m_logTextView = new LogViewer(logUI);
m_logTextView->setReadOnly(true);
m_logTextView->setTextInteractionFlags(Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse);
m_logTextView->connectLogger(&g_logger); // connect to global logger
m_progressBar = new QProgressBar(logUI);
m_progressBar->setRange(0,100);
m_progressBar->setValue(0);
m_progressBar->hide();
connect(m_fileLoader, SIGNAL(loadStepStarted(QString)),
this, SLOT(setProgressBarText(QString)));
connect(m_fileLoader, SIGNAL(loadProgress(int)),
m_progressBar, SLOT(setValue(int)));
connect(m_fileLoader, SIGNAL(resetProgress()),
m_progressBar, SLOT(hide()));
QVBoxLayout* logUILayout = new QVBoxLayout(logUI);
//logUILayout->setContentsMargins(2,2,2,2);
logUILayout->addWidget(m_logTextView);
logUILayout->addWidget(m_progressBar);
//m_logTextView->setLineWrapMode(QPlainTextEdit::NoWrap);
logDock->setWidget(logUI);
// Data set list UI
QDockWidget* dataSetDock = new QDockWidget(tr("Data Sets"), this);
dataSetDock->setFeatures(QDockWidget::DockWidgetMovable |
QDockWidget::DockWidgetClosable |
QDockWidget::DockWidgetFloatable);
DataSetUI* dataSetUI = new DataSetUI(this);
dataSetDock->setWidget(dataSetUI);
QAbstractItemView* dataSetOverview = dataSetUI->view();
dataSetOverview->setModel(m_geometries);
connect(dataSetOverview, SIGNAL(doubleClicked(const QModelIndex&)),
m_pointView, SLOT(centerOnGeometry(const QModelIndex&)));
m_pointView->setSelectionModel(dataSetOverview->selectionModel());
// Set up docked widgets
addDockWidget(Qt::RightDockWidgetArea, shaderParamsDock);
addDockWidget(Qt::LeftDockWidgetArea, shaderEditorDock);
addDockWidget(Qt::RightDockWidgetArea, logDock);
addDockWidget(Qt::RightDockWidgetArea, dataSetDock);
tabifyDockWidget(logDock, dataSetDock);
logDock->raise();
shaderEditorDock->setVisible(false);
// Add dock widget toggles to view menu
viewMenu->addSeparator();
viewMenu->addAction(shaderParamsDock->toggleViewAction());
viewMenu->addAction(logDock->toggleViewAction());
viewMenu->addAction(dataSetDock->toggleViewAction());
// Create custom hook events from CLI at runtime
m_hookManager = new HookManager(this);
}
示例9: setupUi
MainWindow::MainWindow()
{
setupUi(this);
// add window for tool parameters
QDockWidget *dockWidget_toolParams = new QDockWidget(this);
dockWidget_toolParams->setWindowTitle("Parameters");
QWidget *dockWidgetContent_toolParams = new QWidget();
dockWidget_toolParams->setWidget(dockWidgetContent_toolParams);
QGridLayout * gridLayout_toolParams = new QGridLayout(dockWidgetContent_toolParams);
int indRow=1;
QDoubleSpinBox * radiusSpinBox = addDoubleParameter("radius", dockWidgetContent_toolParams, gridLayout_toolParams, indRow);
QSpinBox * nbPointsSpinBox = addIntParameter("nb points", dockWidgetContent_toolParams, gridLayout_toolParams, indRow);
QSpacerItem * verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
//QPushButton * pushButton_ok = new QPushButton("OK", dockWidgetContent_toolParams);
int indCol=0, rowSpan=1, colSpan=1;
//gridLayout_toolParams->addWidget(pushButton_ok,indRow, indCol, rowSpan, 2);
//indRow++;
gridLayout_toolParams->addItem(verticalSpacer, indRow, indCol, rowSpan, colSpan);
addDockWidget(static_cast<Qt::DockWidgetArea>(1), dockWidget_toolParams);
//QMainWindow::splitDockWidget(dockWidget_toolParams, layersWidget, static_cast<Qt::Orientation>(2));
m_matParametersView = new MaterialParametersView();
setCentralWidget(m_matParametersView);
m_reducedCoordinatesView = new ReducedCoordinatesView();
QDockWidget *dockWidget = new QDockWidget(this);
dockWidget->setWidget(m_reducedCoordinatesView);
//dockWidget->setFeatures( QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable);
dockWidget->setObjectName(QString::fromUtf8("family plot"));
dockWidget->setVisible(true);
addDockWidget(static_cast<Qt::DockWidgetArea>(2), dockWidget);
dockWidget->setFloating(true);
dockWidget->setAllowedAreas(Qt::NoDockWidgetArea);
setAcceptDrops(true);
std::vector<QString> materialParameterStrings((int)exProject::UndefinedType);
materialParameterStrings[exProject::EXType] = "EX";
materialParameterStrings[exProject::EYType] = "EY";
materialParameterStrings[exProject::EZType] = "EZ";
materialParameterStrings[exProject::NuXYType] = "NuXY";
materialParameterStrings[exProject::NuXZType] = "NuXZ";
materialParameterStrings[exProject::NuYZType] = "NuYZ";
materialParameterStrings[exProject::MuXYType] = "MuXY";
materialParameterStrings[exProject::MuXZType] = "MuXZ";
materialParameterStrings[exProject::MuYZType] = "MuYZ";
materialParameterStrings[exProject::DensityType] = "Density";
materialParameterStrings[exProject::StrengthType] = "Strength";
addMaterialParameterOptions(*m_x_comboBox, materialParameterStrings);
addMaterialParameterOptions(*m_y_comboBox, materialParameterStrings);
addMaterialParameterOptions(*m_z_comboBox, materialParameterStrings);
addMaterialParameterOptions(*m_col_comboBox, materialParameterStrings);
m_action2D->setChecked(true);
m_actionRegionSelection->setChecked(false);
std::vector<QString> typeStrings;
typeStrings.push_back("Cubic");
typeStrings.push_back("Orthotropic");
addMaterialParameterOptions(*m_type_comboBox, typeStrings);
m_x_comboBox->setCurrentIndex((int)exProject::EXType);
m_y_comboBox->setCurrentIndex((int)exProject::NuXYType);
m_z_comboBox->setCurrentIndex((int)exProject::DensityType);
m_col_comboBox->setCurrentIndex((int)exProject::MuXYType);
m_project = new exProject();
m_project->setFileDirectory("..//..//Output//");
setDim();
setType();
setParamToVisualize(0, m_x_comboBox->currentIndex());
setParamToVisualize(1, m_y_comboBox->currentIndex());
setParamToVisualize(2, m_z_comboBox->currentIndex());
setParamToVisualize(3, m_col_comboBox->currentIndex());
m_matParametersView->setProject(m_project);
m_materialStructureView->setProject(m_project);
m_reducedCoordinatesView->setProject(m_project);
connect(radiusSpinBox, SIGNAL(valueChanged(double)), m_matParametersView, SLOT(onRadiusValueChanged(double)));
connect(nbPointsSpinBox, SIGNAL(valueChanged(int)), m_matParametersView, SLOT(onNbPointsValueChanged(int)));
}