void tst_QDockWidget::dockLocationChanged() { qRegisterMetaType<Qt::DockWidgetArea>("Qt::DockWidgetArea"); QMainWindow mw; QDockWidget dw; dw.setObjectName("dock1"); QSignalSpy spy(&dw, SIGNAL(dockLocationChanged(Qt::DockWidgetArea))); mw.addDockWidget(Qt::LeftDockWidgetArea, &dw); QCOMPARE(spy.count(), 1); QCOMPARE(qvariant_cast<Qt::DockWidgetArea>(spy.at(0).at(0)), Qt::LeftDockWidgetArea); spy.clear(); mw.addDockWidget(Qt::LeftDockWidgetArea, &dw); QCOMPARE(spy.count(), 1); QCOMPARE(qvariant_cast<Qt::DockWidgetArea>(spy.at(0).at(0)), Qt::LeftDockWidgetArea); spy.clear(); mw.addDockWidget(Qt::RightDockWidgetArea, &dw); QCOMPARE(spy.count(), 1); QCOMPARE(qvariant_cast<Qt::DockWidgetArea>(spy.at(0).at(0)), Qt::RightDockWidgetArea); spy.clear(); mw.removeDockWidget(&dw); QCOMPARE(spy.count(), 0); QDockWidget dw2; dw2.setObjectName("dock2"); mw.addDockWidget(Qt::TopDockWidgetArea, &dw2); mw.tabifyDockWidget(&dw2, &dw); QCOMPARE(spy.count(), 1); QCOMPARE(qvariant_cast<Qt::DockWidgetArea>(spy.at(0).at(0)), Qt::TopDockWidgetArea); spy.clear(); mw.splitDockWidget(&dw2, &dw, Qt::Horizontal); QCOMPARE(spy.count(), 1); QCOMPARE(qvariant_cast<Qt::DockWidgetArea>(spy.at(0).at(0)), Qt::TopDockWidgetArea); spy.clear(); dw.setFloating(true); QTest::qWait(100); dw.setFloating(false); QTest::qWait(100); QCOMPARE(spy.count(), 1); QCOMPARE(qvariant_cast<Qt::DockWidgetArea>(spy.at(0).at(0)), Qt::TopDockWidgetArea); spy.clear(); QByteArray ba = mw.saveState(); mw.restoreState(ba); QCOMPARE(spy.count(), 1); QCOMPARE(qvariant_cast<Qt::DockWidgetArea>(spy.at(0).at(0)), Qt::TopDockWidgetArea); }
CEAbstractDockWidget::CEAbstractDockWidget(CrystallographyExtension *ext) : DockWidget(), m_ext(ext) { connect(this, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(storeDockWidgetArea(Qt::DockWidgetArea))); }
/** \param a **/ BlDockWidget::BlDockWidget ( const QString & title, QWidget * parent, const QString &name , Qt::WindowFlags flags ) : QDockWidget ( title, parent, flags ) { BL_FUNC_DEBUG setFocusPolicy ( Qt::StrongFocus ); m_name = name; setObjectName ( name ); connect ( this, SIGNAL ( dockLocationChanged ( Qt::DockWidgetArea ) ), this, SLOT ( mi_dockLocationChanged ( Qt::DockWidgetArea ) ) ); }
void ThumbBarDock::reInitialize() { // Measure orientation of the widget and adjust the child thumbbar to this // orientation and size. QMainWindow* parent = qobject_cast<QMainWindow*>(parentWidget()); emit dockLocationChanged(parent->dockWidgetArea(this)); widget()->resize(size()); update(); }
KoModeBoxDocker::KoModeBoxDocker(KoModeBox *modeBox) : m_modeBox(modeBox) { setWidget(modeBox); setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable); setWindowTitle(""); setObjectName("ModeBox"); connect(this, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(locationChanged(Qt::DockWidgetArea))); }
KWStatisticsDocker::KWStatisticsDocker() { m_canvasReset = false; setWindowTitle(i18n("Statistics")); m_statisticsWidget = new KWStatisticsWidget(this); connect(this, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(ondockLocationChanged(Qt::DockWidgetArea))); setWidget(m_statisticsWidget); }
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; }
RcUnitContainerWidget::RcUnitContainerWidget(QWidget *parent) : QDockWidget(parent), ui(new Ui::RcUnitContainerWidget) { ui->setupUi(this); splitter = 0; mOrientation = Qt::Horizontal; connect(HilecSingleton::hilec(), SIGNAL(rcUnitsChanged(bool)), SLOT(updateRcUnits(bool))); connect(HilecSingleton::hilec(), SIGNAL(rcUnitFlagsUpdated(QString,QVariantList)), SLOT(unitFlagsUpdated(QString,QVariantList))); connect(this, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), SLOT(onDockLocationChanged(Qt::DockWidgetArea))); }
BaseDockWidget::BaseDockWidget(char* title, QSize size, bool isNeed) { this->title = FontChina::G2U(title); widget = new QWidget(); this->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable); this->setAllowedAreas(Qt::AllDockWidgetAreas); this->size = size; this->setMinimumSize(size); this->setMaximumSize(size); this->setWindowTitle(FontChina::G2U(title)); this->setWidget(widget); widget->setStyleSheet("background-color: rgb(191, 191, 191);"); connect(this, SIGNAL(featuresChanged(QDockWidget::DockWidgetFeatures)), this, SLOT(featuresChanged(QDockWidget::DockWidgetFeatures))); connect(this, SIGNAL(topLevelChanged(bool)), this, SLOT(topLevelChanged(bool))); connect(this, SIGNAL(allowedAreasChanged(Qt::DockWidgetAreas)), this, SLOT(allowedAreasChanged(Qt::DockWidgetAreas))); connect(this, SIGNAL(visibilityChanged(bool)), this, SLOT(visibilityChanged(bool))); connect(this, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(dockLocationChanged(Qt::DockWidgetArea))); if (isNeed){ NeedMinOrMaxToolButton(); } }
void LC_WidgetFactory::createRightSidebar(QG_ActionHandler* action_handler) { QDockWidget* dock_layer = new QDockWidget(main_window); dock_layer->setWindowTitle(QC_ApplicationWindow::tr("Layer List")); dock_layer->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); dock_layer->setObjectName("layer_dockwidget"); layer_widget = new QG_LayerWidget(action_handler, dock_layer, "Layer"); layer_widget->setFocusPolicy(Qt::NoFocus); connect(layer_widget, SIGNAL(escape()), main_window, SLOT(slotFocus())); connect(main_window, SIGNAL(windowsChanged(bool)), layer_widget, SLOT(setEnabled(bool))); dock_layer->setWidget(layer_widget); QDockWidget* dock_block = new QDockWidget(main_window); dock_block->setWindowTitle(QC_ApplicationWindow::tr("Block List")); dock_block->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); dock_block->setObjectName("block_dockwidget"); block_widget = new QG_BlockWidget(action_handler, dock_block, "Block"); block_widget->setFocusPolicy(Qt::NoFocus); connect(block_widget, SIGNAL(escape()), main_window, SLOT(slotFocus())); connect(main_window, SIGNAL(windowsChanged(bool)), block_widget, SLOT(setEnabled(bool))); dock_block->setWidget(block_widget); QDockWidget* dock_library = new QDockWidget(main_window); dock_library->setWindowTitle(QC_ApplicationWindow::tr("Library Browser")); dock_library->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); dock_library->setObjectName("library_dockwidget"); library_widget = new QG_LibraryWidget(dock_library, "Library"); library_widget->setActionHandler(action_handler); library_widget->setFocusPolicy(Qt::NoFocus); connect(library_widget, SIGNAL(escape()), main_window, SLOT(slotFocus())); connect(main_window, SIGNAL(windowsChanged(bool)), (QObject*)library_widget->bInsert, SLOT(setEnabled(bool))); dock_library->setWidget(library_widget); dock_library->resize(240, 400); QDockWidget* dock_command = new QDockWidget(QC_ApplicationWindow::tr("Command line"), main_window); dock_command->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); dock_command->setObjectName("command_dockwidget"); command_widget = new QG_CommandWidget(dock_command, "Command"); command_widget->setActionHandler(action_handler); connect(main_window, SIGNAL(windowsChanged(bool)), command_widget, SLOT(setEnabled(bool))); connect(command_widget->leCommand, SIGNAL(escape()), main_window, SLOT(setFocus())); dock_command->setWidget(command_widget); connect(dock_command, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), main_window, SLOT(modifyCommandTitleBar(Qt::DockWidgetArea))); main_window->addDockWidget(Qt::RightDockWidgetArea, dock_library); main_window->tabifyDockWidget(dock_library, dock_block); main_window->tabifyDockWidget(dock_block, dock_layer); main_window->addDockWidget(Qt::RightDockWidgetArea, dock_command); }
void ImageWindow::setupConnections() { setupStandardConnections(); connect(this, SIGNAL(loadCurrentLater()), this, SLOT(slotLoadCurrent()), Qt::QueuedConnection); // To toggle properly keyboards shortcuts from comments & tags side bar tab. connect(d->rightSideBar, SIGNAL(signalNextItem()), this, SLOT(slotForward())); connect(d->rightSideBar, SIGNAL(signalPrevItem()), this, SLOT(slotBackward())); connect(d->rightSideBar->getFiltersHistoryTab(), SIGNAL(actionTriggered(const ImageInfo&)), this, SLOT(openImage(const ImageInfo&))); connect(this, SIGNAL(signalSelectionChanged( const QRect&)), d->rightSideBar, SLOT(slotImageSelectionChanged( const QRect&))); connect(this, SIGNAL(signalNoCurrentItem()), d->rightSideBar, SLOT(slotNoCurrentItem())); ImageAttributesWatch* watch = ImageAttributesWatch::instance(); connect(watch, SIGNAL(signalFileMetadataChanged(const KUrl&)), this, SLOT(slotFileMetadataChanged(const KUrl&))); /*connect(DatabaseAccess::databaseWatch(), SIGNAL(collectionImageChange(const CollectionImageChangeset&)), this, SLOT(slotCollectionImageChange(const CollectionImageChangeset&)), Qt::QueuedConnection);*/ connect(ThemeEngine::instance(), SIGNAL(signalThemeChanged()), this, SLOT(slotThemeChanged())); /*connect(d->imageFilterModel, SIGNAL(rowsAboutToBeRemoved(const QModelIndex&, int, int)), this, SLOT(slotRowsAboutToBeRemoved(const QModelIndex&, int, int)));*/ connect(d->thumbBar, SIGNAL(currentChanged(const ImageInfo&)), this, SLOT(slotThumbBarImageSelected(const ImageInfo&))); connect(d->dragDropHandler, SIGNAL(imageInfosDropped(const QList<ImageInfo>&)), this, SLOT(slotDroppedOnThumbbar(const QList<ImageInfo>&))); connect(d->thumbBarDock, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), d->thumbBar, SLOT(slotDockLocationChanged(Qt::DockWidgetArea))); connect(AlbumSettings::instance(), SIGNAL(setupChanged()), this, SLOT(slotSetupChanged())); }
void BaseStationCoreUi::setupUi() { //FILE menu creation saveSVGEAction = new QAction(tr("Save Map to SVG"), this); QMenu *fileMenu = this->menuBar()->addMenu(tr("&File")); fileMenu->addAction(saveSVGEAction); saveMapForTestsAction = new QAction(tr("Save Map for further tests"), this); fileMenu->addAction(saveMapForTestsAction); showConfigurationInterfaceAction = new QAction(tr("Configure..."), this); QMenu *configureMenu = this->menuBar()->addMenu(tr("&Preferences")); configureMenu->addAction(showConfigurationInterfaceAction); connect(showConfigurationInterfaceAction, SIGNAL(triggered()), this, SLOT(onShowConfigurationGUIDemand())); //Clean map features QMenu *advancedMenu = this->menuBar()->addMenu(tr("&Advanced")); QAction *cleanMap = new QAction(tr("Clean Map of the selected robot"), this); advancedMenu->addAction(cleanMap); connect(cleanMap, SIGNAL(triggered()), this, SLOT(onMapTrouble())); teleoperationDock->setWidget(teleoperationWidget); addDockWidget(Qt::TopDockWidgetArea, thumbnailsDock); addDockWidget(Qt::TopDockWidgetArea, teleoperationDock); addDockWidget(Qt::RightDockWidgetArea, bigCameraDock); addDockWidget(Qt::RightDockWidgetArea, rightDock); addDockWidget(Qt::BottomDockWidgetArea, messageDock); this->setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea); this->setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea); QWidget* singleRobotWidget = new QWidget(); QVBoxLayout *l = new QVBoxLayout(); // l->addWidget(focusCamera); l->addWidget(singleRobotInfo); // focusCamera->setParent(singleRobotWidget); singleRobotInfo->setParent(singleRobotWidget); singleRobotWidget->setLayout(l); thumbnails->setLayout(thumbnailsLayout); thumbnailsDock->setWidget(thumbnails); rightDock->setWidget(singleRobotWidget); bigCameraDock->setWidget(focusCamera); bigCameraDock->setLayout(new QGridLayout()); bigCameraDock->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); messageDock->setWidget(messageViewer); connect(bigCameraDock, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(onDockPositionChanged())); this->hide(); }
QgsUserInputDockWidget::QgsUserInputDockWidget( QWidget *parent ) : QgsDockWidget( tr( "User Input Panel" ), parent ) , mLayoutHorizontal( true ) { QWidget* w = new QWidget( nullptr ); mLayout = new QBoxLayout( QBoxLayout::LeftToRight ); mLayout->setAlignment( Qt::AlignLeft | Qt::AlignTop ); w->setLayout( mLayout ); setWidget( w ); connect( this, SIGNAL( dockLocationChanged( Qt::DockWidgetArea ) ), this, SLOT( areaChanged( Qt::DockWidgetArea ) ) ); connect( this, SIGNAL( topLevelChanged( bool ) ), this, SLOT( floatingChanged( bool ) ) ); hide(); }
KoToolBoxDocker::KoToolBoxDocker(KoToolBox *toolBox) : QDockWidget(i18n("Toolbox")) , m_toolBox(toolBox) { setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable); setWidget(toolBox); connect(this, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(updateToolBoxOrientation(Qt::DockWidgetArea))); connect(this, SIGNAL(topLevelChanged(bool)), this, SLOT(updateFloating(bool))); KoDockWidgetTitleBar* titleBar = new KoDockWidgetTitleBar(this); titleBar->setTextVisibilityMode(KoDockWidgetTitleBar::TextCanBeInvisible); titleBar->setToolTip(i18n("Tools")); setTitleBarWidget(titleBar); }
QgsUserInputDockWidget::QgsUserInputDockWidget( QWidget *parent ) : QDockWidget( tr( "User input" ), parent ) , mLayoutHorizontal( true ) { QWidget* w = new QWidget( 0 ); mLayout = new QBoxLayout( QBoxLayout::LeftToRight ); mLayout->setAlignment( Qt::AlignLeft | Qt::AlignTop ); w->setLayout( mLayout ); setWidget( w ); QPalette pal = palette(); pal.setColor( QPalette::Background, QColor( 231, 245, 254 ) ); setPalette( pal ); setAutoFillBackground( true ); connect( this, SIGNAL( dockLocationChanged( Qt::DockWidgetArea ) ), this, SLOT( areaChanged( Qt::DockWidgetArea ) ) ); connect( this, SIGNAL( topLevelChanged( bool ) ), this, SLOT( floatingChanged( bool ) ) ); hide(); }
toDocklet::toDocklet(const QString &title, QWidget *parent, toWFlags flags) : QDockWidget(title, parent, flags), isPopup(false) { setFocusPolicy(Qt::StrongFocus); setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); connect(this, SIGNAL(activated()), this, SLOT(childActivated())); connect(this, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(handleDockletLocationChanged(Qt::DockWidgetArea))); }
KoToolDocker::KoToolDocker(QWidget *parent) : QDockWidget(QObject::tr("Tool Options"), parent), d(new Private(this)) { setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::TopDockWidgetArea); //KConfigGroup cfg = KGlobal::config()->group("DockWidget sharedtooldocker"); QSettings cfg("QCalligra", QCoreApplication::applicationName()); cfg.beginGroup("DockWidget sharedtooldocker"); d->tabbed = cfg.value("TabbedMode", false).toBool(); cfg.endGroup(); toggleViewAction()->setVisible(false); //should always be visible, so hide option in menu setFeatures(DockWidgetMovable|DockWidgetFloatable); setTitleBarWidget(new KoDockWidgetTitleBar(this)); connect(this, SIGNAL(dockLocationChanged(Qt::DockWidgetArea )), this, SLOT(locationChanged(Qt::DockWidgetArea))); d->housekeeperWidget = new QWidget(); d->housekeeperLayout = new QGridLayout(); d->housekeeperWidget->setLayout(d->housekeeperLayout); d->housekeeperLayout->setSizeConstraint(QLayout::SetMinAndMaxSize); d->hiderWidget = new QWidget(d->housekeeperWidget); d->hiderWidget->setVisible(false); d->scrollArea = new QScrollArea(); d->scrollArea->setWidget(d->housekeeperWidget); d->scrollArea->setFrameShape(QFrame::NoFrame); d->scrollArea->setWidgetResizable(true); d->scrollArea->setFocusPolicy(Qt::NoFocus); setWidget(d->scrollArea); d->tabButton = new QToolButton(this); // parent hack in toggleLock to keep it clickable d->tabButton->setIcon(d->tabIcon); d->tabButton->setToolTip(QObject::tr("Toggles organising the options in tabs or not")); d->tabButton->setAutoRaise(true); connect(d->tabButton, SIGNAL(clicked()), SLOT(toggleTab())); d->tabButton->resize(d->tabButton->sizeHint()); }
Sidebar::Sidebar(QWidget *parent, Qt::DockWidgetArea location) :QDockWidget(i18n("Workflow")) { Q_UNUSED(parent) setFeatures(QDockWidget::AllDockWidgetFeatures); m_table = new SidebarTableWidget(location); m_table->setParent(this); setWidget(m_table); m_delegate = new SidebarDelegate(this); m_table->setItemDelegate(m_delegate); connect(m_table, SIGNAL(clicked(const QModelIndex &)), this, SIGNAL(currentIndexClicked(const QModelIndex &))); connect(this, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), m_table,SLOT(updateLayout(Qt::DockWidgetArea))); }
void TabBarDockWidget::setup(QMenu *closedWindowsMenu) { QWidget *widget = new QWidget(this); m_tabBar = new TabBarWidget(widget); m_trashButton = new QToolButton(widget); m_trashButton->setAutoRaise(true); m_trashButton->setEnabled(false); m_trashButton->setIcon(Utils::getIcon(QLatin1String("user-trash"))); m_trashButton->setToolTip(tr("Closed Tabs")); m_trashButton->setMenu(closedWindowsMenu); m_trashButton->setPopupMode(QToolButton::InstantPopup); QBoxLayout *tabsLayout = new QBoxLayout(QBoxLayout::LeftToRight, widget); tabsLayout->addWidget(m_tabBar); tabsLayout->addSpacing(32); tabsLayout->addWidget(m_trashButton); tabsLayout->setContentsMargins(0, 0, 0, 0); tabsLayout->setSpacing(0); widget->setLayout(tabsLayout); setTitleBarWidget(NULL); setWidget(widget); m_newTabButton->setAutoRaise(true); m_newTabButton->setDefaultAction(ActionsManager::getAction(QLatin1String("NewTab"), this)); m_newTabButton->setFixedSize(32, 32); m_newTabButton->show(); m_newTabButton->raise(); m_newTabButton->move(m_tabBar->geometry().topRight()); connect(this, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), m_tabBar, SLOT(setOrientation(Qt::DockWidgetArea))); connect(m_tabBar, SIGNAL(moveNewTabButton(int)), this, SLOT(moveNewTabButton(int))); }
helpView::helpView(QWidget *parent) : QDockWidget(tr("xTuple Help Documentation"), parent) { setObjectName("helpView"); _layoutContainer = new QWidget(this); _layout = new QGridLayout; _layout->setSpacing(0); _helpBrowser = new helpViewBrowser(this); _help = xtHelp::getInstance(this); _helpBrowserToolbar = new QToolBar(this); QAction *back = _helpBrowserToolbar->addAction(iconFromImageByName("ImgLeftArrow"), tr("Back"), _helpBrowser, SLOT(backward())); QAction *fwd = _helpBrowserToolbar->addAction(iconFromImageByName("ImgRightArrow"),tr("Forward"), _helpBrowser, SLOT(forward())); QAction *home = _helpBrowserToolbar->addAction(iconFromImageByName("home_32"), tr("Home"), _helpBrowser, SLOT(home())); connect(_helpBrowser, SIGNAL(backwardAvailable(bool)), back, SLOT(setEnabled(bool))); connect(_helpBrowser, SIGNAL(forwardAvailable(bool)), fwd, SLOT(setEnabled(bool))); connect(_helpBrowser, SIGNAL(backwardAvailable(bool)), home, SLOT(setEnabled(bool))); connect(_help->contentWidget(), SIGNAL(linkActivated(const QUrl&)), this, SLOT(sIndexChanged(const QUrl&))); connect(this, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(sLocationChanged(Qt::DockWidgetArea))); _layout->addWidget(_helpBrowserToolbar, 0, 0, 1, -1); _layout->addWidget(_help->contentWidget(), 1, 0); if(_help->isOnline()) { _help->contentWidget()->hide(); sIndexChanged(QUrl("index.html")); } _layout->addWidget(_helpBrowser, 2, 0); _layoutContainer->setLayout(_layout); setWidget(_layoutContainer); omfgThis->addDockWidget(Qt::TopDockWidgetArea, this); }
CEViewOptionsWidget::CEViewOptionsWidget(CrystallographyExtension *ext) : CEAbstractDockWidget(ext), m_glWidget(NULL), m_currentArea(Qt::NoDockWidgetArea), m_ncc(NCC_Invalid), m_colorDialog(0), m_origColor(new QColor()) { this->setPreferredDockWidgetArea(Qt::BottomDockWidgetArea); ui.setupUi(this); // Initialize the view axis button group ui.rad_axis_default->setChecked(true); connect(ui.aCellSpinBox, SIGNAL(valueChanged(int)), this, SLOT(updateRepeatCells())); connect(ui.bCellSpinBox, SIGNAL(valueChanged(int)), this, SLOT(updateRepeatCells())); connect(ui.cCellSpinBox, SIGNAL(valueChanged(int)), this, SLOT(updateRepeatCells())); connect(ui.spin_mi_h, SIGNAL(valueChanged(int)), this, SLOT(millerIndexChanged())); connect(ui.spin_mi_k, SIGNAL(valueChanged(int)), this, SLOT(millerIndexChanged())); connect(ui.spin_mi_l, SIGNAL(valueChanged(int)), this, SLOT(millerIndexChanged())); connect(ui.buttonGroup_camera, SIGNAL(buttonClicked(int)), this, SLOT(updateCamera())); connect(ui.combo_numCells, SIGNAL(currentIndexChanged(int)), this, SLOT(updateCellRenderOptions())); connect(ui.push_changeColor, SIGNAL(clicked()), this, SLOT(selectCellColor())); /* connect(ui.aButton, SIGNAL(clicked()), this, SLOT(updateViewAxis())); connect(ui.aStarButton, SIGNAL(clicked()), this, SLOT(updateViewAxis())); connect(ui.bButton, SIGNAL(clicked()), this, SLOT(updateViewAxis())); connect(ui.aStarButton, SIGNAL(clicked()), this, SLOT(updateViewAxis())); connect(ui.cButton, SIGNAL(clicked()), this, SLOT(updateViewAxis())); connect(ui.cStarButton, SIGNAL(clicked()), this, SLOT(updateViewAxis())); */ connect(ext, SIGNAL(cellChanged()), this, SLOT(cellChanged())); // Rearrange the widgets when we change from left/right to top/bottom // position connect(this, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(updateLayout(Qt::DockWidgetArea))); // Also update when the floating state changes connect(this, SIGNAL(topLevelChanged(bool)), this, SLOT(updateLayout(bool))); this->updateLayout(this->isFloating()); // Check if we have a hexagonal unit cell for mi_i box cellChanged(); QSettings settings; int ncc = settings.value("crystallography/viewWidget/numCellChoice", static_cast<int>(NCC_All)).toInt(); ui.combo_numCells->setCurrentIndex(ncc); }
void TransferFunctionPropertyDialog::generateWidget() { vec2 minEditorDims = vec2(255.0f, 100.0f); tfEditorView_ = new TransferFunctionEditorView(tfProperty_); tfProperty_->get().addObserver(tfEditorView_); // put origin to bottom left corner tfEditorView_->scale(1.0, -1.0); tfEditorView_->setAlignment(Qt::AlignLeft | Qt::AlignBottom); tfEditorView_->setMinimumSize(minEditorDims.x, minEditorDims.y); tfEditorView_->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); tfEditorView_->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); tfEditor_ = new TransferFunctionEditor(&tfProperty_->get(), tfEditorView_); connect(tfEditor_, SIGNAL(doubleClick()), this, SLOT(showColorDialog())); connect(tfEditor_, SIGNAL(selectionChanged()), this, SLOT(updateColorWheel())); tfEditorView_->setScene(tfEditor_); zoomVSlider_ = new RangeSliderQt(Qt::Vertical, this); zoomVSlider_->setRange(0, sliderRange_); zoomVSlider_->setMinSeparation(5); // flip slider values to compensate for vertical slider layout zoomVSlider_->setValue(sliderRange_ - static_cast<int>(tfProperty_->getZoomV().y*sliderRange_), sliderRange_ - static_cast<int>(tfProperty_->getZoomV().x*sliderRange_)); connect(zoomVSlider_, SIGNAL(valuesChanged(int, int)), this, SLOT(changeVerticalZoom(int, int))); zoomHSlider_ = new RangeSliderQt(Qt::Horizontal, this); zoomHSlider_->setRange(0, sliderRange_); zoomHSlider_->setMinSeparation(5); zoomHSlider_->setValue(static_cast<int>(tfProperty_->getZoomH().x*sliderRange_), static_cast<int>(tfProperty_->getZoomH().y*sliderRange_)); connect(zoomHSlider_, SIGNAL(valuesChanged(int, int)), this, SLOT(changeHorizontalZoom(int, int))); maskSlider_ = new RangeSliderQt(Qt::Horizontal, this); maskSlider_->setRange(0, sliderRange_); maskSlider_->setValue(static_cast<int>(tfProperty_->getMask().x*sliderRange_), static_cast<int>(tfProperty_->getMask().y*sliderRange_)); connect(maskSlider_, SIGNAL(valuesChanged(int, int)), this, SLOT(changeMask(int, int))); colorWheel_ = new ColorWheel(); connect(colorWheel_, SIGNAL(colorChange(QColor)), this, SLOT(setPointColor(QColor))); btnClearTF_ = new QPushButton("Reset"); connect(btnClearTF_, SIGNAL(clicked()), tfEditor_, SLOT(resetTransferFunction())); btnClearTF_->setStyleSheet(QString("min-width: 30px; padding-left: 7px; padding-right: 7px;")); btnImportTF_ = new QPushButton("Import"); connect(btnImportTF_, SIGNAL(clicked()), this, SLOT(importTransferFunction())); btnImportTF_->setStyleSheet(QString("min-width: 30px; padding-left: 7px; padding-right: 7px;")); btnExportTF_ = new QPushButton("Export"); connect(btnExportTF_, SIGNAL(clicked()), this, SLOT(exportTransferFunction())); btnExportTF_->setStyleSheet(QString("min-width: 30px; padding-left: 7px; padding-right: 7px;")); tfPreview_ = new QLabel(); tfPreview_->setMinimumSize(1,20); QSizePolicy sliderPol = tfPreview_->sizePolicy(); sliderPol.setHorizontalStretch(3); tfPreview_->setSizePolicy(sliderPol); cmbInterpolation_ = new QComboBox(); cmbInterpolation_->addItem("Interpolation: Linear"); //cmbInterpolation_->addItem("Interpolation: Cubic"); // Not implemented... (yet) cmbInterpolation_->setCurrentIndex(tfProperty_->get().getInterpolationType()); connect(cmbInterpolation_, SIGNAL(currentIndexChanged(int)), this, SLOT(switchInterpolationType(int))); chkShowHistogram_ = new QComboBox(); chkShowHistogram_->addItem("Histogram: Off"); chkShowHistogram_->addItem("Histogram: 100%"); chkShowHistogram_->addItem("Histogram: 99%"); chkShowHistogram_->addItem("Histogram: 95%"); chkShowHistogram_->addItem("Histogram: 90%"); chkShowHistogram_->addItem("Histogram: Log"); chkShowHistogram_->setCurrentIndex(tfProperty_->getShowHistogram()); connect(chkShowHistogram_, SIGNAL(currentIndexChanged(int)), this, SLOT(showHistogram(int))); pointMoveMode_ = new QComboBox(); pointMoveMode_->addItem("Point Movement: Free"); pointMoveMode_->addItem("Point Movement: Restrict"); pointMoveMode_->addItem("Point Movement: Push"); pointMoveMode_->setCurrentIndex(0); connect(pointMoveMode_, SIGNAL(currentIndexChanged(int)), this, SLOT(changeMoveMode(int))); colorDialog_ = new QColorDialog(this); colorDialog_->hide(); colorDialog_->setOption(QColorDialog::ShowAlphaChannel, true); colorDialog_->setOption(QColorDialog::NoButtons, true); colorDialog_->setWindowModality(Qt::NonModal); colorDialog_->setWindowTitle(QString::fromStdString(tfProperty_->getDisplayName())); connect(colorDialog_, SIGNAL(currentColorChanged(QColor)), this, SLOT(setPointColorDialog(QColor))); QFrame* leftPanel = new QFrame(this); QGridLayout* leftLayout = new QGridLayout(); leftLayout->setContentsMargins(0, 0, 0, 0); leftLayout->setSpacing(7); leftLayout->addWidget(zoomVSlider_, 0, 0); leftLayout->addWidget(tfEditorView_, 0, 1); leftLayout->addWidget(zoomHSlider_, 1, 1); leftLayout->addWidget(tfPreview_, 2, 1); leftLayout->addWidget(maskSlider_, 3, 1); leftPanel->setLayout(leftLayout); QFrame* rightPanel = new QFrame(this); QVBoxLayout* rightLayout = new QVBoxLayout(); rightLayout->setContentsMargins(0, 0, 0, 0); rightLayout->setSpacing(7); rightLayout->setAlignment(Qt::AlignTop); rightLayout->addWidget(colorWheel_); rightLayout->addWidget(cmbInterpolation_); rightLayout->addWidget(chkShowHistogram_); rightLayout->addWidget(pointMoveMode_); rightLayout->addStretch(3); QHBoxLayout* rowLayout = new QHBoxLayout(); rowLayout->addWidget(btnClearTF_); rowLayout->addWidget(btnImportTF_); rowLayout->addWidget(btnExportTF_); rightLayout->addLayout(rowLayout); rightPanel->setLayout(rightLayout); QWidget* mainPanel = new QWidget(this); QHBoxLayout* mainLayout = new QHBoxLayout(); mainLayout->setContentsMargins(7, 7, 7, 7); mainLayout->setSpacing(7); mainLayout->addWidget(leftPanel); mainLayout->addWidget(rightPanel); mainPanel->setLayout(mainLayout); setWidget(mainPanel); connect(this, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(dockLocationChanged(Qt::DockWidgetArea))); initialize(tfProperty_); setFloating(true); setVisible(false); }
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; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); setMouseTracking(true); /******************* * * QDockWidget Setup * ******************/ // add right dock container m_dockright = new QDockWidget(this); m_dockright->setAllowedAreas(Qt::RightDockWidgetArea | Qt::LeftDockWidgetArea); // dockright->setStyleSheet("background-color: lightgrey"); this->addDockWidget(Qt::RightDockWidgetArea, m_dockright); // add left dock container m_dockleft = new QDockWidget(this); m_dockleft->setAllowedAreas(Qt::RightDockWidgetArea | Qt::LeftDockWidgetArea); // dockright->setStyleSheet("background-color: lightgrey"); this->addDockWidget(Qt::LeftDockWidgetArea, m_dockleft); /******************* * * IndigoDock Setup * ******************/ // TabWidget IndigoDock *indigoDock_r = new IndigoDock; // Container m_mainLayout_r = new QGridLayout(); m_mainLayout_r->setMargin(0); m_mainLayout_r->addWidget(indigoDock_r, 0, 0); QWidget *containerRight = new QWidget; containerRight->setLayout(m_mainLayout_r); // set Layouted Widget to DockPanel m_dockright->setWidget(containerRight); connect(m_dockright, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), indigoDock_r, SLOT(updateTabWidget(Qt::DockWidgetArea))); // TabWidget IndigoDock *indigoDock_l = new IndigoDock; indigoDock_l->m_indigoTab->setTabPosition(IndigoTabbar::West); // Container m_mainLayout_l = new QGridLayout(); m_mainLayout_l->setMargin(0); m_mainLayout_l->addWidget(indigoDock_l, 0, 0); QWidget *containerLeft = new QWidget; containerLeft->setLayout(m_mainLayout_l); // set Layouted Widget to DockPanel m_dockleft->setWidget(containerLeft); connect(m_dockleft, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), indigoDock_l, SLOT(updateTabWidget(Qt::DockWidgetArea))); IndigoMenuBar *menuBar = new IndigoMenuBar(); setMenuBar(menuBar); new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this, SLOT(close())); // right dock IndigoPanel *panel = new IndigoPanel(this); panel->setCaption("Properties"); panel->setIcon(QIcon(":/icons/icons/placeholder.png")); indigoDock_r->addIndigoPanel(panel); IndigoPanel *panel2 = new IndigoPanel(this); panel2->setCaption("Page"); panel2->setIcon(QIcon(":/icons/icons/placeholder.png")); indigoDock_r->addIndigoPanel(panel2, 0); // left dock IndigoPanel *panel3 = new IndigoPanel(this); panel3->setCaption("Preflight"); panel3->setIcon(QIcon(":/icons/icons/placeholder.png")); indigoDock_l->addIndigoPanel(panel3); IndigoPanel *panel4 = new IndigoPanel(this); panel4->setCaption("Text"); panel4->setIcon(QIcon(":/icons/icons/placeholder.png")); indigoDock_l->addIndigoPanel(panel4); }
ShapeCollectionDocker::ShapeCollectionDocker(QWidget* parent) : QDockWidget(parent) { setWindowTitle(QObject::tr("Add Shape")); QWidget* mainWidget = new QWidget(this); m_layout = new QGridLayout(mainWidget); m_layout->setMargin(0); m_layout->setHorizontalSpacing(0); m_layout->setVerticalSpacing(0); m_layout->setSizeConstraint(QLayout::SetMinAndMaxSize); setWidget(mainWidget); m_quickView = new QListView (mainWidget); m_layout->addWidget(m_quickView, 0, 0); m_quickView->setViewMode(QListView::IconMode); m_quickView->setDragDropMode(QListView::DragOnly); m_quickView->setSelectionMode(QListView::SingleSelection); m_quickView->setResizeMode(QListView::Adjust); m_quickView->setFlow(QListView::LeftToRight); m_quickView->setGridSize(QSize(40, 44)); m_quickView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_quickView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_quickView->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); m_quickView->setTextElideMode(Qt::ElideNone); m_quickView->setWordWrap(true); m_spacer = new QSpacerItem(0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed); m_layout->addItem(m_spacer, 1, 2); m_layout->setRowStretch(1, 1); m_layout->setColumnStretch(2, 1); connect(this, SIGNAL(dockLocationChanged(Qt::DockWidgetArea )), this, SLOT(locationChanged(Qt::DockWidgetArea))); connect(m_quickView, SIGNAL(clicked(const QModelIndex&)), this, SLOT(activateShapeCreationToolFromQuick(const QModelIndex&))); m_moreShapes = new QToolButton(mainWidget); m_moreShapes->setText(QObject::tr("More")); m_moreShapes->setToolButtonStyle(Qt::ToolButtonIconOnly); m_moreShapes->setIconSize(QSize(32, 32)); m_moreShapes->setIcon(koIcon("shape-choose")); m_moreShapes->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); m_layout->addWidget(m_moreShapes, 0, 1); m_moreShapesContainer = new CollectionMenu(mainWidget); m_moreShapes->setMenu(m_moreShapesContainer); m_moreShapes->setPopupMode(QToolButton::InstantPopup); QGridLayout *containerLayout = new QGridLayout(m_moreShapesContainer); containerLayout->setMargin(4); m_collectionChooser = new QListWidget (m_moreShapesContainer); containerLayout->addWidget(m_collectionChooser, 0, 0, 1, 2); m_collectionChooser->setViewMode(QListView::IconMode); m_collectionChooser->setSelectionMode(QListView::SingleSelection); m_collectionChooser->setResizeMode(QListView::Adjust); m_collectionChooser->setGridSize(QSize(75, 64)); m_collectionChooser->setMovement(QListView::Static); m_collectionChooser->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_collectionChooser->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); connect(m_collectionChooser, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(activateShapeCollection(QListWidgetItem *))); m_addCollectionButton = new QToolButton (m_moreShapesContainer); containerLayout->addWidget(m_addCollectionButton, 1, 0); m_addCollectionButton->setIcon(koIcon("list-add")); m_addCollectionButton->setIconSize(QSize(16, 16)); m_addCollectionButton->setToolTip(QObject::tr("Open Shape Collection")); m_addCollectionButton->setPopupMode(QToolButton::InstantPopup); m_addCollectionButton->setVisible(false); m_closeCollectionButton = new QToolButton (m_moreShapesContainer); containerLayout->addWidget(m_closeCollectionButton, 1, 1); m_closeCollectionButton->setIcon(koIcon("list-remove")); m_closeCollectionButton->setIconSize(QSize(16, 16)); m_closeCollectionButton->setToolTip(QObject::tr("Remove Shape Collection")); m_closeCollectionButton->setVisible(false); connect(m_closeCollectionButton, SIGNAL(clicked()), this, SLOT(removeCurrentCollection())); //if(! KGlobal::activeComponent().dirs()->resourceDirs("app_shape_collections").isEmpty()) //{ // buildAddCollectionMenu(); //} m_collectionView = new QListView (m_moreShapesContainer); containerLayout->addWidget(m_collectionView, 0, 2, -1, 1); m_collectionView->setViewMode(QListView::IconMode); m_collectionView->setDragDropMode(QListView::DragOnly); m_collectionView->setSelectionMode(QListView::SingleSelection); m_collectionView->setResizeMode(QListView::Adjust); m_collectionView->setGridSize(QSize(48+20, 48)); m_collectionView->setFixedSize(QSize(165,345)); m_collectionView->setWordWrap(true); connect(m_collectionView, SIGNAL(clicked(const QModelIndex&)), this, SLOT(activateShapeCreationTool(const QModelIndex&))); // Load the default shapes and add them to the combobox loadDefaultShapes(); }