TToolBar::TToolBar( TAction * pA, QString name, QWidget * pW ) : QDockWidget( pW ) , mpTAction( pA ) , mVerticalOrientation( false ) , mpWidget( new QWidget( this ) ) , mName( name ) , mRecordMove( false ) , mpLayout( 0 ) , mItemCount( 0 ) { setFeatures( QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable ); setWidget( mpWidget ); if( ! mpTAction->mUseCustomLayout ) { mpLayout = new QGridLayout( mpWidget ); setContentsMargins(0,0,0,0); mpLayout->setContentsMargins(0,0,0,0); mpLayout->setSpacing(0); QSizePolicy sizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred); mpWidget->setSizePolicy( sizePolicy ); } QWidget * test = new QWidget; setTitleBarWidget(test); setStyleSheet( mpTAction->css ); mpWidget->setStyleSheet( mpTAction->css ); }
MaxMinPanel::MaxMinPanel(QString title, QWidget* parent) { panelMinimised = false; setWindowTitle(title); setTitleBarWidget(new Titlebar(this)); }
GameInfoPanel::GameInfoPanel(const QString &title, QWidget *parent) : QDockWidget(parent) { // setup ui QGridLayout *l = new QGridLayout(); QWidget *widget = new QWidget(this); diceTextLabel = new QLabel("Rolled:", widget); diceTextLabel->setVisible(false); die1PixmapLabel = new QLabel(widget); die2PixmapLabel = new QLabel(widget); currentPlayerLabel = new QLabel("No player", widget); currentPlayerLabel->setObjectName("currentPlayerLabel"); turnLabel = new QLabel("Initial turn", widget); turnLabel->setObjectName("turnLabel"); l->addWidget(turnLabel, 0, 0, 1, 4, Qt::AlignLeft); l->addWidget(currentPlayerLabel, 1, 0, 1, 4, Qt::AlignLeft); l->addWidget(diceTextLabel, 2, 0, Qt::AlignLeft); l->addWidget(die1PixmapLabel, 2, 1, Qt::AlignRight); l->addWidget(die2PixmapLabel, 2, 2, Qt::AlignRight); l->setColumnStretch(3, 1); l->setRowStretch(3, 1); widget->setLayout(l); setWidget(widget); setFixedHeight(110); setFeatures(QDockWidget::NoDockWidgetFeatures); setTitleBarWidget(new QWidget(this)); }
ScriptEditorWidget::ScriptEditorWidget() : _scriptEditorWidgetUI(new Ui::ScriptEditorWidget), _scriptEngine(NULL), _isRestarting(false), _isReloading(false) { setAttribute(Qt::WA_DeleteOnClose); _scriptEditorWidgetUI->setupUi(this); connect(_scriptEditorWidgetUI->scriptEdit->document(), &QTextDocument::modificationChanged, this, &ScriptEditorWidget::scriptModified); connect(_scriptEditorWidgetUI->scriptEdit->document(), &QTextDocument::contentsChanged, this, &ScriptEditorWidget::onScriptModified); // remove the title bar (see the Qt docs on setTitleBarWidget) setTitleBarWidget(new QWidget()); QFontMetrics fm(_scriptEditorWidgetUI->scriptEdit->font()); _scriptEditorWidgetUI->scriptEdit->setTabStopWidth(fm.width('0') * 4); // We create a new ScriptHighligting QObject and provide it with a parent so this is NOT a memory leak. new ScriptHighlighting(_scriptEditorWidgetUI->scriptEdit->document()); QTimer::singleShot(0, _scriptEditorWidgetUI->scriptEdit, SLOT(setFocus())); _console = new JSConsole(this); _console->setFixedHeight(CONSOLE_HEIGHT); _scriptEditorWidgetUI->verticalLayout->addWidget(_console); connect(_scriptEditorWidgetUI->clearButton, &QPushButton::clicked, _console, &JSConsole::clear); }
TextTools::TextTools(QWidget* parent) : QDockWidget(parent) { _textElement = 0; setObjectName("text-tools"); setWindowTitle(tr("Text Tools")); setAllowedAreas(Qt::DockWidgetAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea)); QToolBar* tb = new QToolBar(tr("Text Edit")); tb->setIconSize(QSize(preferences.iconWidth * guiScaling, preferences.iconHeight * guiScaling)); showKeyboard = getAction("show-keys"); showKeyboard->setCheckable(true); tb->addAction(showKeyboard); typefaceBold = tb->addAction(*icons[int(Icons::textBold_ICON)], ""); typefaceBold->setToolTip(tr("Bold")); typefaceBold->setCheckable(true); typefaceItalic = tb->addAction(*icons[int(Icons::textItalic_ICON)], ""); typefaceItalic->setToolTip(tr("Italic")); typefaceItalic->setCheckable(true); typefaceUnderline = tb->addAction(*icons[int(Icons::textUnderline_ICON)], ""); typefaceUnderline->setToolTip(tr("Underline")); typefaceUnderline->setCheckable(true); tb->addSeparator(); typefaceSubscript = tb->addAction(*icons[int(Icons::textSub_ICON)], ""); typefaceSubscript->setToolTip(tr("Subscript")); typefaceSubscript->setCheckable(true); typefaceSuperscript = tb->addAction(*icons[int(Icons::textSuper_ICON)], ""); typefaceSuperscript->setToolTip(tr("Superscript")); typefaceSuperscript->setCheckable(true); tb->addSeparator(); typefaceFamily = new QFontComboBox(this); tb->addWidget(typefaceFamily); typefaceSize = new QDoubleSpinBox(this); typefaceSize->setFocusPolicy(Qt::ClickFocus); tb->addWidget(typefaceSize); setWidget(tb); QWidget* w = new QWidget(this); setTitleBarWidget(w); titleBarWidget()->hide(); connect(typefaceSize, SIGNAL(valueChanged(double)), SLOT(sizeChanged(double))); connect(typefaceFamily, SIGNAL(currentFontChanged(const QFont&)), SLOT(fontChanged(const QFont&))); connect(typefaceBold, SIGNAL(triggered(bool)), SLOT(boldClicked(bool))); connect(typefaceItalic, SIGNAL(triggered(bool)), SLOT(italicClicked(bool))); connect(typefaceUnderline, SIGNAL(triggered(bool)), SLOT(underlineClicked(bool))); connect(typefaceSubscript, SIGNAL(triggered(bool)), SLOT(subscriptClicked(bool))); connect(typefaceSuperscript, SIGNAL(triggered(bool)), SLOT(superscriptClicked(bool))); connect(showKeyboard, SIGNAL(toggled(bool)), SLOT(showKeyboardClicked(bool))); }
void MainWidget::CreateUI() { qDebug("MainWidget::CreateUI()"); setMainWidgetTitle("zTranslate / 1.0"); //soft keys softKey = new ZSoftKey(NULL , this , this); softKey->setText(ZSoftKey::LEFT, "Menu", (ZSoftKey::TEXT_PRIORITY)0); softKey->setTextForOptMenuHide("Menu"); QRect rect = ZGlobal::getContentR(); menu = new ZOptionsMenu(rect, this, 0, 0, (ZSkinService::WidgetClsID)55); menu->setItemSpacing(10); pm = QPixmap(QString("img/icon/translate.png")); menu->insertItem(tr(" Перевести"),&pm,this,SLOT(slotConnectInternet())); pm = QPixmap(QString("img/icon/options.png")); menu->insertItem(tr(" Настройки"),&pm,this,SLOT(slotSetting())); pm = QPixmap(QString("img/icon/about.png")); menu->insertItem(tr(" О программе..."),&pm,this,SLOT(about())); pm = QPixmap(QString("img/icon/exit.png")); menu->insertItem(tr(" Выход"),&pm,this,SLOT(slotQuit())); softKey->setText(ZSoftKey::RIGHT, tr("Выход"), (ZSoftKey::TEXT_PRIORITY)0); softKey->setClickedSlot(ZSoftKey::RIGHT, this, SLOT(slotQuit())); softKey->setOptMenu(ZSoftKey::LEFT, menu); zapp = new ZAppInfoArea(this,"app info", 0, ZSkinService::clsZAppInfoArea); zapp->insertText(ZAppInfoArea::ACTIVITY, 0, "", NULL); form = new ZFormContainer(this, 0, ZSkinService::clsZFormContainer); LineEdit1 = new ZLineEdit(this); form->addChild(LineEdit1); button1 = new ZPressButton(this); connect(button1,SIGNAL(pressed()),SLOT(slotShowSrcLng())); buttonUpdate(); form->addChild(button1); MultiLine = new ZMultiLineEdit(this); form->addChild(MultiLine); LineEdit1->setText(""); MultiLine->setText(""); setContentWidget(form); setTitleBarWidget(zapp); setSoftKey(softKey); show(); }
void DolphinDockWidget::setLocked(bool lock) { if (lock != m_locked) { m_locked = lock; if (lock) { if (!m_dockTitleBar) { m_dockTitleBar = new DolphinDockTitleBar(this); } setTitleBarWidget(m_dockTitleBar); setFeatures(QDockWidget::NoDockWidgetFeatures); } else { setTitleBarWidget(0); setFeatures(DefaultDockWidgetFeatures); } } }
void ResourceDock::setupHTools() { auto htools = new QFrame(this); auto vlayout = new QVBoxLayout(htools); vlayout->setMargin(2); vlayout->setSpacing(0); auto hlayoutTitle = new QHBoxLayout(); auto title = new QLabel(htools); title->setText("Resource Explorer "); title->setStyleSheet("color: lightGray;"); hlayoutTitle->addWidget(title); auto sepBrush = QBrush(Qt::gray, Qt::BrushStyle::Dense6Pattern); QPalette sepPalette; sepPalette.setBrush(QPalette::Background, sepBrush); auto seprator = new QLabel(htools); seprator->setAutoFillBackground(true); seprator->setPalette(sepPalette); seprator->setMaximumHeight(10); hlayoutTitle->addWidget(seprator, 1, Qt::AlignBottom); auto btnClose = new QToolButton(htools); btnClose->setText("X"); btnClose->setStyleSheet("color: lightGray\n"); btnClose->setAutoRaise(true); btnClose->setMaximumWidth(16); btnClose->setMaximumHeight(16); hlayoutTitle->addWidget(btnClose); connect(btnClose, &QToolButton::clicked, this, &QDockWidget::hide); vlayout->addLayout(hlayoutTitle); vlayout->addSpacing(2); auto hlayoutTools = new QHBoxLayout(); hlayoutTools->setMargin(0); hlayoutTools->setSpacing(0); auto btnCollAll = new QToolButton(htools); btnCollAll->setIcon(QIcon(":/icons/col")); btnCollAll->setToolTip("Collapse All"); btnCollAll->setToolButtonStyle(Qt::ToolButtonIconOnly); connect(btnCollAll, &QToolButton::clicked, resTree, &QTreeWidget::collapseAll); hlayoutTools->addWidget(btnCollAll); hlayoutTools->addSpacing(5); auto ledit = new QLineEdit(htools); ledit->setPlaceholderText("Search"); ledit->addAction(QIcon(":/icons/search"), QLineEdit::ActionPosition::TrailingPosition); ledit->setStyleSheet("background-color: gray;"); connect(ledit, &QLineEdit::textChanged, this, &ResourceDock::searchAct); hlayoutTools->addWidget(ledit, 1); vlayout->addLayout(hlayoutTools); htools->setLayout(vlayout); setTitleBarWidget(htools); }
//------------------------------------------------------------------------------ // InitDockTitleBar // void LogDock::InitDockTitleBar() { // Title Bar Stuff DockTitleBar* bar = new DockTitleBar(this); setTitleBarWidget(bar); bar->SetTitle(windowTitle(), 12); bar->SetFloating(false); connect(bar, SIGNAL(Close()), this, SLOT(close())); }
WebInspectorDockWidget::WebInspectorDockWidget(QupZilla* mainClass) : QDockWidget(mainClass) , p_QupZilla(mainClass) { setWindowTitle(tr("Web Inspector")); setObjectName("WebInspector"); setFeatures(0); setTitleBarWidget(new DockTitleBarWidget(tr("Web Inspector"), this)); show(); }
LookupPanel::LookupPanel() : QDockWidget(tr("Search")) { _wordEdit = new QLineEdit(this); connect(_wordEdit, SIGNAL(returnPressed()), this, SLOT(editingFinished())); _toolBar = new QToolBar(this); _toolBar->setFloatable(false); _toolBar->setAllowedAreas(Qt::NoToolBarArea); _toolBar->setMovable(false); // remove excessive space around small buttons _toolBar->setStyleSheet("QToolButton{margin:0}"); // Go Home button. _homeAct = new QAction(QIcon(":/images/go-home.svg"), tr("Title page"), this); _toolBar->addAction(_homeAct); connect(_homeAct, SIGNAL(triggered()), this, SLOT(goHome())); // Previous Entry button. Backspace added as an important // shortcut. _previousAct = new QAction(QIcon(":/images/go-previous.svg"), tr("Previous"), this); QList<QKeySequence> previousActShortcuts; previousActShortcuts.append(QKeySequence::Back); previousActShortcuts.append(Qt::Key_Backspace); _previousAct->setShortcuts(previousActShortcuts); connect(_previousAct, SIGNAL(triggered()), this, SLOT(goPrevious())); _toolBar->addAction(_previousAct); // Next Entry button. _nextAct = new QAction(QIcon(":/images/go-next.svg"), tr("Next"), this); _nextAct->setShortcut(QKeySequence::Forward); connect(_nextAct, SIGNAL(triggered()), this, SLOT(goNext())); _toolBar->addAction(_nextAct); // Update displayed entry history and register a slot catching its changes. historyChanged(); connect(&_history, SIGNAL(changed()), this, SLOT(historyChanged())); // Vertical fixed layout without margins. QWidget *layoutWidget = new QWidget(this); QVBoxLayout *layout = new QVBoxLayout(layoutWidget); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); layout->setSizeConstraint(QLayout::SetMaximumSize); layout->addWidget(_wordEdit); layout->addWidget(_toolBar); layoutWidget->setMaximumHeight(_wordEdit->height() + _toolBar->height()); layoutWidget->setLayout(layout); setWidget(layoutWidget); // Not movable, no title bar. setAllowedAreas(Qt::LeftDockWidgetArea); setFeatures(QDockWidget::NoDockWidgetFeatures); setContentsMargins(0, 4, 2, 4); setTitleBarWidget(new QWidget(this)); // no title bar }
TPanel::TPanel(QWidget *parent, Qt::WindowFlags flags, TDockWidget::Orientation orientation) : TDockWidget(parent, flags), m_panelType(""), m_isMaximizable(true), m_isMaximized(false), m_isActive(true), m_panelTitleBar(0), m_multipleInstancesAllowed(true) { //setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable); //setFloating(false); m_panelTitleBar = new TPanelTitleBar(this, orientation); setTitleBarWidget(m_panelTitleBar); //connect(m_panelTitleBar,SIGNAL(doubleClick()),this,SLOT(onDoubleClick())); connect(m_panelTitleBar, SIGNAL(doubleClick(QMouseEvent *)), this, SIGNAL(doubleClick(QMouseEvent *))); connect(m_panelTitleBar, SIGNAL(closeButtonPressed()), this, SLOT(onCloseButtonPressed())); setOrientation(orientation); }
EditTools::EditTools(QWidget* parent) : QDockWidget(parent) { setObjectName("edit-tools"); setWindowTitle(tr("Edit Mode Tools")); setAllowedAreas(Qt::DockWidgetAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea)); QToolBar* tb = new QToolBar(tr("Edit Mode Tools")); tb->setIconSize(QSize(preferences.iconWidth, preferences.iconHeight)); QToolButton* b = new QToolButton(this); QAction* a = getAction("hraster"); a->setCheckable(true); b->setDefaultAction(a); b->setContextMenuPolicy(Qt::ActionsContextMenu); b->addAction(getAction("config-raster")); tb->addWidget(b); b = new QToolButton(this); a = getAction("vraster"); a->setCheckable(true); b->setDefaultAction(a); b->setContextMenuPolicy(Qt::ActionsContextMenu); b->addAction(getAction("config-raster")); tb->addWidget(b); _editX = new QDoubleSpinBox(this); _editX->setSuffix(tr("sp")); _editX->setRange(-99999, 99999); _editX->setSingleStep(.1); _editY = new QDoubleSpinBox(this); _editY->setSuffix(tr("sp")); _editY->setRange(-99999, 99999); _editY->setSingleStep(.1); xLabel = new QLabel(tr("x:"), this); yLabel = new QLabel(tr("y:"), this); _localEdit = false; tb->addWidget(xLabel); tb->addWidget(_editX); tb->addWidget(yLabel); tb->addWidget(_editY); connect(_editX, SIGNAL(valueChanged(double)), SLOT(editXChanged(double))); connect(_editY, SIGNAL(valueChanged(double)), SLOT(editYChanged(double))); setWidget(tb); QWidget* w = new QWidget(this); setTitleBarWidget(w); titleBarWidget()->hide(); }
InviwoDockWidget::InviwoDockWidget(QString title, QWidget *parent) : QDockWidget(title, parent) { setObjectName(title); #ifdef __APPLE__ setStyleSheet("QDockWidget::title {padding-left: 45px; }"); #endif // adding custom title bar to dock widget dockWidgetTitleBar_ = new InviwoDockWidgetTitleBar(this); setTitleBarWidget(dockWidgetTitleBar_); QObject::connect(this, SIGNAL(topLevelChanged(bool)), titleBarWidget(), SLOT(floating(bool))); QObject::connect(this, SIGNAL(windowTitleChanged(const QString &)), this, SLOT(updateWindowTitle(const QString &))); }
DrumTools::DrumTools(QWidget* parent) : QDockWidget(parent) { drumset = 0; _score = 0; setObjectName("drum-tools"); setAllowedAreas(Qt::DockWidgetAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea)); QWidget* w = new QWidget(this); w->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); w->setMaximumHeight(100); QHBoxLayout* layout = new QHBoxLayout; w->setLayout(layout); QVBoxLayout* layout1 = new QVBoxLayout; layout1->setSpacing(6); pitchName = new QLabel; pitchName->setAlignment(Qt::AlignCenter); pitchName->setWordWrap(true); pitchName->setContentsMargins(25, 0, 25, 0); layout1->addWidget(pitchName); QHBoxLayout* buttonLayout = new QHBoxLayout; buttonLayout->setContentsMargins(25, 10, 25, 10); editButton = new QToolButton; editButton->setMinimumWidth(100); editButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); buttonLayout->addWidget(editButton); layout1->addLayout(buttonLayout); layout->addLayout(layout1); drumPalette = new Palette; drumPalette->setMag(0.8); drumPalette->setSelectable(true); drumPalette->setGrid(28, 60); PaletteScrollArea* sa = new PaletteScrollArea(drumPalette); sa->setFocusPolicy(Qt::NoFocus); layout->addWidget(sa); setWidget(w); w = new QWidget(this); setTitleBarWidget(w); titleBarWidget()->hide(); connect(editButton, SIGNAL(clicked()), SLOT(editDrumset())); void boxClicked(int); connect(drumPalette, SIGNAL(boxClicked(int)), SLOT(drumNoteSelected(int))); retranslate(); drumPalette->setContextMenuPolicy(Qt::PreventContextMenu); }
void MainWindowPrivate::createDockWidget() { Q_Q(MainWindow); const auto dockWidget = new QDockWidget(q); dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures); const auto treeView = new QTreeView(dockWidget); treeView->header()->hide(); treeView->setAttribute(Qt::WA_MacShowFocusRect, 0); treeView->setModel(_model.data()); q->connect(treeView->selectionModel(), &QItemSelectionModel::currentChanged, q, &MainWindow::onClicked); dockWidget->setWidget(treeView); dockWidget->setTitleBarWidget(new QWidget); q->addDockWidget(Qt::LeftDockWidgetArea, dockWidget); }
CSVDoc::Operations::Operations() { /// \todo make widget height fixed (exactly the height required to display all operations) setFeatures (QDockWidget::NoDockWidgetFeatures); QWidget *widgetContainer = new QWidget (this); mLayout = new QVBoxLayout; widgetContainer->setLayout (mLayout); setWidget (widgetContainer); setVisible (false); setFixedHeight (widgetContainer->height()); setTitleBarWidget (new QWidget (this)); }
/**************************************************************************** ** ** Copyright (C) 2016 - 2017 ** ** This file is generated by the Magus toolkit ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ****************************************************************************/ // Include #include "material_browser.h" #include "material_tree.h" //****************************************************************************/ MaterialTreeDockWidget::MaterialTreeDockWidget(const QString& iconDir, const QString& title, QMainWindow* parent, Qt::WindowFlags flags) : QDockWidget (title, parent, flags), mParent(parent) { mIconDir = iconDir; mEmptyString = ""; mResourceTreeWidget = new Magus::QtResourceTreeWidget(iconDir); mResourceTreeWidget->mActionDuplicateAssetText = QString("Clone material"); mResourceTreeWidget->mActionDeleteResourceText = QString("Remove from list"); mResourceTreeWidget->setAddAssetAfterDuplicateAssetSelected(false); // Do not duplicate automatically mResourceTreeWidget->setCreateTopLevelGroupContextMenuItemEnabled(false); mResourceTreeWidget->setDeleteTopLevelGroupEnabled(false); mResourceTreeWidget->setTopLevelGroupItemEditable(false); mResourceTreeWidget->setSubLevelGroupItemEditable(true); mResourceTreeWidget->setCreateAssetContextMenuItemEnabled(false); mResourceTreeWidget->setAssetItemEditable(false); mResourceTreeWidget->setDeleteResourceContextMenuItemEnabled(true); mResourceTreeWidget->setImportAssetContextMenuItemEnabled(false); mResourceTreeWidget->setDuplicateAssetContextMenuItemEnabled(true); // Miscellanious settings mResourceTreeWidget->addCustomContextMenuItem(ACTION_EDIT); // Listen to events. // Note, that although the 'create asset' context menu is disabled, the MaterialTreeDockWidget must still handle the 'resourceAdded' // signal, because it is also emitted when a subgroup is created in the mResourceTreeWidget; the subgroup must be added to // mSourceInfo after creation, to be able to recursively delete any assets resided in subgroups (these assets must also be // properly deleted from the MaterialThumbsDockWidget). connect(mResourceTreeWidget, SIGNAL(resourceSelected(int)), this, SLOT(handleResourceSelected(int))); connect(mResourceTreeWidget, SIGNAL(resourceDoubleClicked(int)), this, SLOT(handleResourceDoubleClicked(int))); connect(mResourceTreeWidget, SIGNAL(resourceAdded(int)), this, SLOT(handleResourceAdded(int))); connect(mResourceTreeWidget, SIGNAL(resourceDeleted(int)), this, SLOT(handleResourceDeleted(int))); connect(mResourceTreeWidget, SIGNAL(resourceMoved(int)), this, SLOT(handleResourceMoved(int))); connect(mResourceTreeWidget, SIGNAL(resourceSearched(QString)), this, SLOT(handleResourceSearched(QString))); connect(mResourceTreeWidget, SIGNAL(resourceSearchReset()), this, SLOT(handleResourceSearchReset())); connect(mResourceTreeWidget, SIGNAL(assetDuplicated(int)), this, SLOT(handleResourceDuplicated(int))); connect(mResourceTreeWidget, SIGNAL(customContextMenuItemSelected(QString,int)), this, SLOT(handleCustomContextMenuItemSelected(QString, int))); mInnerMain = new QMainWindow(); mInnerMain->setMinimumSize(100,100); mInnerMain->setCentralWidget(mResourceTreeWidget); setWidget(mInnerMain); QWidget* oldTitleBar = titleBarWidget(); setTitleBarWidget(new QWidget()); delete oldTitleBar; // Add toplevel groups initializeResourceTree(); }
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); }
/**************************************************************************** ** ** Copyright (C) 2014 ** ** This file is generated by the Magus toolkit ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ****************************************************************************/ // Include #include "tool_resourcewidget_collections.h" namespace Magus { //****************************************************************************/ QtCollectionsDockWidget::QtCollectionsDockWidget(const QString& iconDir, const QString& title, QMainWindow* parent, Qt::WindowFlags flags) : QDockWidget (title, parent, flags), mParent(parent) { mIconDir = iconDir; mInnerMain = new QMainWindow(); setWidget(mInnerMain); QWidget* oldTitleBar = titleBarWidget(); setTitleBarWidget(new QWidget()); delete oldTitleBar; // Perform standard functions createActions(); createMenus(); createToolBars(); }
FileList::FileList( QWidget *parent ) : QDockWidget( parent ) { setWindowTitle( "Open Files" ); QWidget *titleWidget = new QWidget( this ); setTitleBarWidget( titleWidget ); mTreeView = new OpenFileTreeView( this, OpenFileTreeView::CloseButtons | OpenFileTreeView::RefreshButtons ); mTreeView->setMinimumWidth( 150 ); setWidget( mTreeView ); connect( gDispatcher, SIGNAL( selectFile( BaseFile * ) ), this, SLOT( selectFile( BaseFile * ) ) ); connect( mTreeView->selectionModel(), SIGNAL( currentChanged( QModelIndex, QModelIndex ) ), this, SLOT( fileSelected() ) ); }
START_NS // ------------------------------------------ #define CONTENT(w) static_cast<k::ContentFrame*>(w) DockWidget::DockWidget(QWidget *parent) : QDockWidget(parent) { setContentsMargins(0,0,0,0); layout()->setMargin(0); layout()->setSpacing(0); setWidget(new ContentFrame(this) ); setFeatures( NoDockWidgetFeatures ); setTitleBarWidget( new QWidget(this) ); // empty }
void DockWidget::setState(bool edit) { QDockWidget::DockWidgetFeatures features; if (edit) { setAllowedAreas(Qt::AllDockWidgetAreas); features = QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable; if (isClosable()) { features |= QDockWidget::DockWidgetClosable; } } else { setAllowedAreas(Qt::NoDockWidgetArea); features = QDockWidget::NoDockWidgetFeatures; if (isFloating()) { features |= QDockWidget::DockWidgetFloatable; } } setFeatures(features); setTitleBarWidget(isFloating() || edit ? Q_NULLPTR : m_titleHide); }
ScriptEditorWidget::ScriptEditorWidget() : _scriptEditorWidgetUI(new Ui::ScriptEditorWidget), _scriptEngine(NULL) { _scriptEditorWidgetUI->setupUi(this); connect(_scriptEditorWidgetUI->scriptEdit->document(), &QTextDocument::modificationChanged, this, &ScriptEditorWidget::scriptModified); connect(_scriptEditorWidgetUI->scriptEdit->document(), &QTextDocument::contentsChanged, this, &ScriptEditorWidget::onScriptModified); // remove the title bar (see the Qt docs on setTitleBarWidget) setTitleBarWidget(new QWidget()); QFontMetrics fm(_scriptEditorWidgetUI->scriptEdit->font()); _scriptEditorWidgetUI->scriptEdit->setTabStopWidth(fm.width('0') * 4); // We create a new ScriptHighligting QObject and provide it with a parent so this is NOT a memory leak. new ScriptHighlighting(_scriptEditorWidgetUI->scriptEdit->document()); QTimer::singleShot(0, _scriptEditorWidgetUI->scriptEdit, SLOT(setFocus())); }
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()); }
DrumTools::DrumTools(QWidget* parent) : QDockWidget(parent) { drumset = 0; _score = 0; setObjectName("drum-tools"); setWindowTitle(tr("Drum Tools")); setAllowedAreas(Qt::DockWidgetAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea)); QWidget* w = new QWidget(this); w->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); QHBoxLayout* layout = new QHBoxLayout; w->setLayout(layout); QVBoxLayout* layout1 = new QVBoxLayout; QToolButton* tb = new QToolButton; tb->setText(tr("Edit Drumset")); layout1->addWidget(tb); layout1->addStretch(); layout->addLayout(layout1); drumPalette = new Palette; drumPalette->setName(tr("Drums")); drumPalette->setMag(0.8); drumPalette->setSelectable(true); drumPalette->setGrid(28, 60); PaletteScrollArea* sa = new PaletteScrollArea(drumPalette); sa->setFocusPolicy(Qt::NoFocus); layout->addWidget(sa); setWidget(w); // setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); w = new QWidget(this); setTitleBarWidget(w); titleBarWidget()->hide(); connect(tb, SIGNAL(clicked()), SLOT(editDrumset())); void boxClicked(int); connect(drumPalette, SIGNAL(boxClicked(int)), SLOT(drumNoteSelected(int))); }
PostDock::PostDock(QWidget* parent): QDockWidget(tr("Post window"), parent) { setAllowedAreas(Qt::BottomDockWidgetArea | Qt::RightDockWidgetArea | Qt::LeftDockWidgetArea); setFeatures(DockWidgetFloatable | DockWidgetMovable | DockWidgetClosable); mPostWindow = new PostWindow(this); setWidget(mPostWindow); QToolBar *toolBar = new QToolBar(); toolBar->addAction(mPostWindow->mAutoScrollAction); QWidget *titleBar = new QWidget(); QHBoxLayout *l = new QHBoxLayout(); l->setContentsMargins(5,2,5,0); l->addWidget(new QLabel(windowTitle()), 1); l->addWidget(toolBar); titleBar->setLayout(l); setTitleBarWidget(titleBar); connect(this, SIGNAL(topLevelChanged(bool)), this, SLOT(onFloatingChanged(bool))); }
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))); }
void TToolBar::clear() { QWidget * pW = new QWidget( this ); setWidget( pW ); mpWidget->deleteLater(); mpWidget = pW; if( ! mpTAction->mUseCustomLayout ) { mpLayout = new QGridLayout( mpWidget ); mpLayout->setContentsMargins(0,0,0,0); mpLayout->setSpacing(0); QSizePolicy sizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); mpWidget->setSizePolicy( sizePolicy ); } else mpLayout = 0; QWidget * test = new QWidget; setStyleSheet( mpTAction->css ); mpWidget->setStyleSheet( mpTAction->css ); setTitleBarWidget( test ); mudlet::self()->removeDockWidget( this ); }
TextTools::TextTools(QWidget* parent) : QDockWidget(parent) { _textElement = 0; setObjectName("text-tools"); setWindowTitle(tr("Text Tools")); setAllowedAreas(Qt::DockWidgetAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea)); QToolBar* tb = new QToolBar(tr("Text Edit")); tb->setIconSize(QSize(preferences.iconWidth, preferences.iconHeight)); textStyles = new QComboBox; tb->addWidget(textStyles); showKeyboard = getAction("show-keys"); showKeyboard->setCheckable(true); tb->addAction(showKeyboard); typefaceBold = tb->addAction(*icons[textBold_ICON], ""); typefaceBold->setToolTip(tr("bold")); typefaceBold->setCheckable(true); typefaceItalic = tb->addAction(*icons[textItalic_ICON], ""); typefaceItalic->setToolTip(tr("italic")); typefaceItalic->setCheckable(true); typefaceUnderline = tb->addAction(*icons[textUnderline_ICON], ""); typefaceUnderline->setToolTip(tr("underline")); typefaceUnderline->setCheckable(true); tb->addSeparator(); QActionGroup* ha = new QActionGroup(tb); leftAlign = new QAction(*icons[textLeft_ICON], "", ha); leftAlign->setToolTip(tr("align left")); leftAlign->setCheckable(true); leftAlign->setData(ALIGN_LEFT); hcenterAlign = new QAction(*icons[textCenter_ICON], "", ha); hcenterAlign->setToolTip(tr("align horizontal center")); hcenterAlign->setCheckable(true); hcenterAlign->setData(ALIGN_HCENTER); rightAlign = new QAction(*icons[textRight_ICON], "", ha); rightAlign->setToolTip(tr("align right")); rightAlign->setCheckable(true); rightAlign->setData(ALIGN_RIGHT); tb->addActions(ha->actions()); QActionGroup* va = new QActionGroup(tb); topAlign = new QAction(*icons[textTop_ICON], "", va); topAlign->setToolTip(tr("align top")); topAlign->setCheckable(true); topAlign->setData(ALIGN_TOP); bottomAlign = new QAction(*icons[textBottom_ICON], "", va); bottomAlign->setToolTip(tr("align bottom")); bottomAlign->setCheckable(true); bottomAlign->setData(ALIGN_BOTTOM); baselineAlign = new QAction(*icons[textBaseline_ICON], "", va); baselineAlign->setToolTip(tr("align vertical baseline")); baselineAlign->setCheckable(true); baselineAlign->setData(ALIGN_BASELINE); vcenterAlign = new QAction(*icons[textVCenter_ICON], "", va); vcenterAlign->setToolTip(tr("align vertical center")); vcenterAlign->setCheckable(true); vcenterAlign->setData(ALIGN_VCENTER); tb->addActions(va->actions()); typefaceSubscript = tb->addAction(*icons[textSub_ICON], ""); typefaceSubscript->setToolTip(tr("subscript")); typefaceSubscript->setCheckable(true); typefaceSuperscript = tb->addAction(*icons[textSuper_ICON], ""); typefaceSuperscript->setToolTip(tr("superscript")); typefaceSuperscript->setCheckable(true); unorderedList = tb->addAction(*icons[formatListUnordered_ICON], ""); unorderedList->setToolTip(tr("unordered list")); orderedList = tb->addAction(*icons[formatListOrdered_ICON], ""); orderedList->setToolTip(tr("ordered list")); indentMore = tb->addAction(*icons[formatIndentMore_ICON], ""); indentMore->setToolTip(tr("indent more")); indentLess = tb->addAction(*icons[formatIndentLess_ICON], ""); indentLess->setToolTip(tr("indent less")); tb->addSeparator(); typefaceFamily = new QFontComboBox(this); tb->addWidget(typefaceFamily); typefaceSize = new QDoubleSpinBox(this); tb->addWidget(typefaceSize); setWidget(tb); QWidget* w = new QWidget(this); setTitleBarWidget(w); titleBarWidget()->hide(); connect(typefaceSize, SIGNAL(valueChanged(double)), SLOT(sizeChanged(double))); connect(typefaceFamily, SIGNAL(currentFontChanged(const QFont&)), SLOT(fontChanged(const QFont&))); connect(typefaceBold, SIGNAL(triggered(bool)), SLOT(boldClicked(bool))); connect(typefaceItalic, SIGNAL(triggered(bool)), SLOT(italicClicked(bool))); connect(typefaceUnderline, SIGNAL(triggered(bool)), SLOT(underlineClicked(bool))); connect(typefaceSubscript, SIGNAL(triggered(bool)), SLOT(subscriptClicked(bool))); connect(typefaceSuperscript, SIGNAL(triggered(bool)), SLOT(superscriptClicked(bool))); connect(typefaceFamily, SIGNAL(currentFontChanged(const QFont&)), SLOT(fontChanged(const QFont&))); connect(ha, SIGNAL(triggered(QAction*)), SLOT(setHalign(QAction*))); connect(va, SIGNAL(triggered(QAction*)), SLOT(setValign(QAction*))); connect(showKeyboard, SIGNAL(triggered(bool)), SLOT(showKeyboardClicked(bool))); connect(textStyles, SIGNAL(currentIndexChanged(int)), SLOT(styleChanged(int))); connect(unorderedList, SIGNAL(triggered()), SLOT(unorderedListClicked())); connect(orderedList, SIGNAL(triggered()), SLOT(orderedListClicked())); connect(indentLess, SIGNAL(triggered()), SLOT(indentLessClicked())); connect(indentMore, SIGNAL(triggered()), SLOT(indentMoreClicked())); }