void SearchWidget::showEvent(QShowEvent *event) { if (!event->spontaneous() && !searchEngine) { QVBoxLayout *vLayout = new QVBoxLayout(this); vLayout->setMargin(0); vLayout->setSpacing(0); searchEngine = new QHelpSearchEngine(&LocalHelpManager::helpEngine(), this); Utils::StyledBar *toolbar = new Utils::StyledBar(this); toolbar->setSingleRow(false); QHelpSearchQueryWidget *queryWidget = searchEngine->queryWidget(); QLayout *tbLayout = new QVBoxLayout(); tbLayout->setSpacing(6); tbLayout->setMargin(4); tbLayout->addWidget(queryWidget); toolbar->setLayout(tbLayout); Utils::StyledBar *toolbar2 = new Utils::StyledBar(this); toolbar2->setSingleRow(false); tbLayout = new QVBoxLayout(); tbLayout->setSpacing(0); tbLayout->setMargin(0); tbLayout->addWidget(resultWidget = searchEngine->resultWidget()); toolbar2->setLayout(tbLayout); vLayout->addWidget(toolbar); vLayout->addWidget(toolbar2); setFocusProxy(queryWidget); connect(queryWidget, SIGNAL(search()), this, SLOT(search())); connect(resultWidget, &QHelpSearchResultWidget::requestShowLink, this, [this](const QUrl &url) { emit linkActivated(url, currentSearchTerms(), false/*newPage*/); }); connect(searchEngine, SIGNAL(searchingStarted()), this, SLOT(searchingStarted())); connect(searchEngine, SIGNAL(searchingFinished(int)), this, SLOT(searchingFinished(int))); QTextBrowser* browser = resultWidget->findChild<QTextBrowser*>(); browser->viewport()->installEventFilter(this); connect(searchEngine, SIGNAL(indexingStarted()), this, SLOT(indexingStarted())); connect(searchEngine, SIGNAL(indexingFinished()), this, SLOT(indexingFinished())); QMetaObject::invokeMethod(&LocalHelpManager::helpEngine(), "setupFinished", Qt::QueuedConnection); }
void BookmarkWidget::setup() { regExp.setPatternSyntax(QRegExp::FixedString); regExp.setCaseSensitivity(Qt::CaseInsensitive); QLayout *vlayout = new QVBoxLayout(this); vlayout->setMargin(0); vlayout->setSpacing(0); searchField = new Utils::FancyLineEdit(this); searchField->setFiltering(true); setFocusProxy(searchField); Utils::StyledBar *toolbar = new Utils::StyledBar(this); toolbar->setSingleRow(false); QLayout *tbLayout = new QHBoxLayout(); tbLayout->setMargin(4); tbLayout->addWidget(searchField); toolbar->setLayout(tbLayout); vlayout->addWidget(toolbar); searchField->installEventFilter(this); connect(searchField, &Utils::FancyLineEdit::textChanged, this, &BookmarkWidget::filterChanged); treeView = new TreeView(this); vlayout->addWidget(treeView); filterBookmarkModel = new QSortFilterProxyModel(this); treeView->setModel(filterBookmarkModel); treeView->setDragEnabled(true); treeView->setAcceptDrops(true); treeView->setAutoExpandDelay(1000); treeView->setDropIndicatorShown(true); treeView->viewport()->installEventFilter(this); treeView->setContextMenuPolicy(Qt::CustomContextMenu); connect(treeView, &TreeView::expanded, this, &BookmarkWidget::expand); connect(treeView, &TreeView::collapsed, this, &BookmarkWidget::expand); connect(treeView, &TreeView::activated, this, &BookmarkWidget::activated); connect(treeView, &TreeView::customContextMenuRequested, this, &BookmarkWidget::customContextMenuRequested); filterBookmarkModel->setFilterKeyColumn(0); filterBookmarkModel->setDynamicSortFilter(true); filterBookmarkModel->setSourceModel(bookmarkManager->treeBookmarkModel()); expandItems(); }
void SettingsWidget::chModule(QListWidgetItem *w) { if (w) { page3->module = (Module *)w->data(Qt::UserRole).value<void *>(); QWidget *w = page3->module->getSettingsWidget(); if (w) { QLayout *layout = w->layout(); layout->setMargin(2); if (QFormLayout *fLayout = qobject_cast<QFormLayout *>(layout)) fLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); else if (QGridLayout *gLayout = qobject_cast<QGridLayout *>(layout)) { if (!gLayout->property("NoVHSpacer").toBool()) { gLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), gLayout->rowCount(), 0); //vSpacer gLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, gLayout->columnCount()); //hSpacer } } page3->scrollA->setWidget(w); w->setAutoFillBackground(false); } else if (page3->scrollA->widget()) page3->scrollA->widget()->close(); //ustawi się na nullptr po usunięciu (WA_DeleteOnClose) } }
QmitkSelectableGLWidget::QmitkSelectableGLWidget(QWidget *parent) : QWidget(parent), m_Ui(new Ui::QmitkSelectableGLWidget) { m_Ui->setupUi(this); QLayout *hlayout; hlayout = m_Ui->hboxLayout; hlayout->setMargin(3); QString rendererName("Renderer::"); rendererName += objectName(); // create Renderer m_Renderer = mitk::VtkPropRenderer::New( qPrintable(rendererName), NULL, mitk::RenderingManager::GetInstance(), mitk::BaseRenderer::RenderingMode::Standard); // create widget QString composedName("QSGLWt::"); if (!objectName().isEmpty()) composedName += objectName(); else composedName += "QmitkGLWidget"; /* * here is the place to define QT-Flags to enable and disable certain OpenGL elements, like StencilBuffer, RGBA and so * on. * See QGLFormat for futher informations * QGL::AlphaChannel: Enable Alpha in Framebuffer * QGL::Rgba enable use of rgba rather than color_index * QGL::StencilBuffer for use of stencilbuffer in OpenGL */ m_RenderWindow = new QmitkRenderWindow(this, composedName, m_Renderer); hlayout->addWidget(m_RenderWindow); }
QWidget *ShapeFileImporter::getImportOptionsWidget(DataDescriptor *pDescriptor) { createFeatureClassIfNeeded(pDescriptor); if (mpFeatureClass.get() == NULL) { return NULL; } if (mpOptionsWidget == NULL) { mpOptionsWidget = new FeatureClassWidget; } VERIFYRV(mpOptionsWidget != NULL, NULL); mpOptionsWidget->initialize(mpFeatureClass.get()); mpOptionsWidget->setAvailableConnectionTypes(getAvailableConnectionTypes()); QLayout* pLayout = mpOptionsWidget->layout(); if (pLayout != NULL) { pLayout->setMargin(10); } return mpOptionsWidget; }
TilesetDock::TilesetDock(QWidget *parent): QDockWidget(parent), mMapDocument(0), mDropDown(new QComboBox), mViewStack(new QStackedWidget), mCurrentTile(0), mCurrentTiles(0) { setObjectName(QLatin1String("TilesetDock")); QWidget *w = new QWidget(this); QLayout *l = new QVBoxLayout(w); l->setSpacing(0); l->setMargin(0); l->addWidget(mDropDown); l->addWidget(mViewStack); mDropDown->setEditable(false); connect(mDropDown, SIGNAL(currentIndexChanged(int)), mViewStack, SLOT(setCurrentIndex(int))); connect(mViewStack, SIGNAL(currentChanged(int)), this, SLOT(updateCurrentTiles())); connect(TilesetManager::instance(), SIGNAL(tilesetChanged(Tileset*)), this, SLOT(tilesetChanged(Tileset*))); setWidget(w); retranslateUi(); setAcceptDrops(true); }
QgsAttributeFormEditorWidget::QgsAttributeFormEditorWidget( QgsEditorWidgetWrapper* editorWidget, QgsAttributeForm* form ) : QWidget( form ) , mWidget( editorWidget ) , mForm( form ) , mMode( DefaultMode ) , mMultiEditButton( new QgsMultiEditToolButton() ) , mBlockValueUpdate( false ) , mIsMixed( false ) , mIsChanged( false ) { if ( !mWidget || !mForm ) return; QLayout* l = new QHBoxLayout(); l->setMargin( 0 ); l->setContentsMargins( 0, 0, 0, 0 ); l->addWidget( mWidget->widget() ); if ( mWidget->widget() ) { mWidget->widget()->setObjectName( mWidget->field().name() ); } connect( mWidget, SIGNAL( valueChanged( const QVariant& ) ), this, SLOT( editorWidgetChanged( const QVariant & ) ) ); connect( mMultiEditButton, SIGNAL( resetFieldValueTriggered() ), this, SLOT( resetValue() ) ); connect( mMultiEditButton, SIGNAL( setFieldValueTriggered() ), this, SLOT( setFieldTriggered() ) ); mMultiEditButton->setField( mWidget->field() ); setLayout( l ); updateWidgets(); }
void AboutDialog::displayFile(const QString &fileName, const QString &title) { QDialog *dialog = new QDialog(this); QLayout *layout = new QVBoxLayout(dialog); QTextEdit *textEdit = new QTextEdit(dialog); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal, dialog); textEdit->setStyleSheet(QLatin1String("font-family: monospace")); QFile file(fileName); if (file.open(QIODevice::ReadOnly)) { QString text = QTextStream(&file).readAll(); textEdit->setPlainText(text); } textEdit->setReadOnly(true); connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(close())); buttonBox->setCenterButtons(true); layout->addWidget(textEdit); layout->addWidget(buttonBox); layout->setMargin(6); dialog->setLayout(layout); dialog->setWindowTitle(title); dialog->setWindowFlags(Qt::Sheet); dialog->resize(600, 350); dialog->exec(); }
QtResourceView::QtResourceView(QDesignerFormEditorInterface *core, QWidget *parent) : QWidget(parent), d_ptr(new QtResourceViewPrivate(core)) { d_ptr->q_ptr = this; QIcon editIcon = QIcon::fromTheme("document-properties", qdesigner_internal::createIconSet(QLatin1String("edit.png"))); d_ptr->m_editResourcesAction = new QAction(editIcon, tr("Edit Resources..."), this); d_ptr->m_toolBar->addAction(d_ptr->m_editResourcesAction); connect(d_ptr->m_editResourcesAction, SIGNAL(triggered()), this, SLOT(slotEditResources())); d_ptr->m_editResourcesAction->setEnabled(false); QIcon refreshIcon = QIcon::fromTheme("view-refresh", qdesigner_internal::createIconSet(QLatin1String("reload.png"))); d_ptr->m_reloadResourcesAction = new QAction(refreshIcon, tr("Reload"), this); d_ptr->m_toolBar->addAction(d_ptr->m_reloadResourcesAction); connect(d_ptr->m_reloadResourcesAction, SIGNAL(triggered()), this, SLOT(slotReloadResources())); d_ptr->m_reloadResourcesAction->setEnabled(false); QIcon copyIcon = QIcon::fromTheme("edit-copy", qdesigner_internal::createIconSet(QLatin1String("editcopy.png"))); d_ptr->m_copyResourcePathAction = new QAction(copyIcon, tr("Copy Path"), this); connect(d_ptr->m_copyResourcePathAction, SIGNAL(triggered()), this, SLOT(slotCopyResourcePath())); d_ptr->m_copyResourcePathAction->setEnabled(false); //d_ptr->m_filterWidget = new qdesigner_internal::FilterWidget(0, qdesigner_internal::FilterWidget::LayoutAlignNone); d_ptr->m_filterWidget = new qdesigner_internal::FilterWidget(d_ptr->m_toolBar); d_ptr->m_toolBar->addWidget(d_ptr->m_filterWidget); connect(d_ptr->m_filterWidget, SIGNAL(filterChanged(QString)), this, SLOT(slotFilterChanged(QString))); d_ptr->m_splitter = new QSplitter; d_ptr->m_splitter->setChildrenCollapsible(false); d_ptr->m_splitter->addWidget(d_ptr->m_treeWidget); d_ptr->m_splitter->addWidget(d_ptr->m_listWidget); QLayout *layout = new QVBoxLayout(this); layout->setMargin(0); layout->setSpacing(0); layout->addWidget(d_ptr->m_toolBar); layout->addWidget(d_ptr->m_splitter); d_ptr->m_treeWidget->setColumnCount(1); d_ptr->m_treeWidget->header()->hide(); d_ptr->m_treeWidget->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding)); d_ptr->m_listWidget->setViewMode(QListView::IconMode); d_ptr->m_listWidget->setResizeMode(QListView::Adjust); d_ptr->m_listWidget->setIconSize(QSize(48, 48)); d_ptr->m_listWidget->setGridSize(QSize(64, 64)); connect(d_ptr->m_treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(slotCurrentPathChanged(QTreeWidgetItem*))); connect(d_ptr->m_listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(slotCurrentResourceChanged(QListWidgetItem*))); connect(d_ptr->m_listWidget, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(slotResourceActivated(QListWidgetItem*))); d_ptr->m_listWidget->setContextMenuPolicy(Qt::CustomContextMenu); connect(d_ptr->m_listWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotListWidgetContextMenuRequested(QPoint))); }
IdentityFormWidget::IdentityFormWidget(Form::FormItem *formItem, QWidget *parent) : Form::IFormWidget(formItem,parent), m_ContainerLayout(0) { setObjectName("IdentityFormWidget"); // Create the central widget / layout QGridLayout *mainLayout = new QGridLayout(this); mainLayout->setSpacing(0); mainLayout->setMargin(0); // get options const QStringList &options = formItem->getOptions(); m_Identity = new Identity::IdentityEditorWidget(this); m_Identity->initialize(); Identity::IdentityEditorWidget::AvailableWidgets widgets = Identity::IdentityEditorWidget::FullIdentity; if (options.contains("with-photo", Qt::CaseInsensitive)) widgets |= Identity::IdentityEditorWidget::Photo; if (options.contains("with-address", Qt::CaseInsensitive)) widgets |= Identity::IdentityEditorWidget::FullAddress; if (options.contains("with-login", Qt::CaseInsensitive)) widgets |= Identity::IdentityEditorWidget::FullLogin; m_Identity->setAvailableWidgets(widgets); if (options.contains("xml", Qt::CaseInsensitive)) m_Identity->setXmlInOut(true); if (options.contains("readonly", Qt::CaseInsensitive)) m_Identity->setReadOnly(true); // QtUi Loaded ? const QString &layout = formItem->spec()->value(Form::FormItemSpec::Spec_UiInsertIntoLayout).toString(); if (!layout.isEmpty()) { // Find layout QLayout *lay = formItem->parentFormMain()->formWidget()->findChild<QLayout*>(layout); if (lay) { lay->addWidget(m_Identity); lay->setMargin(0); lay->setSpacing(0); } else { LOG_ERROR("Using the QtUiLinkage, layout not found in the ui: " + formItem->uuid()); } } else { mainLayout->addWidget(m_Identity, 1, 0); } if (options.contains("compact", Qt::CaseInsensitive)) { m_Identity->layout()->setSpacing(0); m_Identity->layout()->setMargin(0); } setFocusedWidget(m_Identity); // create itemdata IdentityWidgetData *data = new IdentityWidgetData(m_FormItem); data->setIdentityFormWiget(this); m_FormItem->setItemData(data); }
Tab::Tab(QWidget *parent) : QWidget (parent) { // Will contain chat window and list of online peers outputSplitter = new QSplitter; // Will split the outputSplitter from the input line inputSplitter = new QSplitter; inputSplitter->setOrientation(Qt::Vertical); // Contains the top portion (output) and bottom (input) QLayout *groupLayout = new QVBoxLayout; // Chat input chatInput = new QTextEdit; chatInput->setMinimumHeight(20); chatInput->setMaximumHeight(100); chatInput->installEventFilter(this); // Add chat viewer and chat input to main splitter inputSplitter->addWidget(outputSplitter); inputSplitter->addWidget(chatInput); // Configure sizing for main vertical splitter inputSplitter->setStretchFactor(0,99); inputSplitter->setStretchFactor(1,1); inputSplitter->setCollapsible(1,false); // Populate chat container QWidget *chatContainer = new QWidget; QLayout *chatContainerLayout = new QVBoxLayout; chat = new QTextBrowser; chatContainerLayout->addWidget(new QLabel("Chat:")); chatContainerLayout->addWidget(chat); chatContainerLayout->setMargin(0); chatContainerLayout->setSpacing(2); chatContainer->setLayout(chatContainerLayout); // Add chat viewer and online list to splitter outputSplitter->addWidget(chatContainer); groupLayout->addWidget(inputSplitter); groupLayout->setMargin(10); groupLayout->setSpacing(5); setLayout(groupLayout); this->setParent(parent); }
BrushEditor::BrushEditor(QDesignerFormEditorInterface *core, QWidget *parent) : QWidget(parent), m_button(new QtColorButton(this)), m_changed(false), m_core(core) { QLayout *layout = new QHBoxLayout(this); layout->setMargin(0); layout->addWidget(m_button); connect(m_button, SIGNAL(colorChanged(QColor)), this, SLOT(brushChanged())); setFocusProxy(m_button); }
DotPlotSplitter::DotPlotSplitter(AnnotatedDNAView* a) : ADVSplitWidget(a), locked(false) { syncLockAction = createAction(":core/images/sync_lock.png", tr("Multiple view synchronization lock"), SLOT(sl_toggleSyncLock(bool))); filterAction = createAction(":dotplot/images/filter.png", tr("Filter results"), SLOT(sl_toggleFilter()), false); zoomInAction = createAction(":core/images/zoom_in.png", tr("Zoom in (<b> + </b>)"), SLOT(sl_toggleZoomIn()), false); zoomOutAction = createAction(":core/images/zoom_out.png", tr("Zoom out (<b> - </b>)"), SLOT(sl_toggleZoomOut()), false); resetZoomingAction = createAction(":core/images/zoom_whole.png", tr("Reset zooming (<b>0</b>)"), SLOT(sl_toggleZoomReset()), false); selAction = createAction(":dotplot/images/cursor.png", tr("Select tool (<b>S</b>)"), SLOT(sl_toggleSel())); handAction = createAction(":dotplot/images/hand_icon.png", tr("Hand tool (<b>H</b>)"), SLOT(sl_toggleHand())); splitter = new QSplitter(Qt::Horizontal); WidgetWithLocalToolbar* wgt = new WidgetWithLocalToolbar(this); QLayout* l = new QVBoxLayout(); l->setMargin(0); l->setSpacing(0); l->addWidget(splitter); wgt->setContentLayout(l); wgt->addActionToLocalToolbar(filterAction); wgt->addActionToLocalToolbar(syncLockAction); wgt->addActionToLocalToolbar(zoomInAction); wgt->addActionToLocalToolbar(zoomOutAction); wgt->addActionToLocalToolbar(resetZoomingAction); wgt->addActionToLocalToolbar(selAction); wgt->addActionToLocalToolbar(handAction); QLayout* mainLayout = new QVBoxLayout(); mainLayout->setSpacing(0); mainLayout->setMargin(0); mainLayout->addWidget(wgt); setLayout(mainLayout); setAcceptDrops(false); setFocus(); }
void StorageInfoView::init() { sinfo = QStorageMetaInfo::instance(); QLayout *layout = new QVBoxLayout( this ); layout->setSpacing( 0 ); layout->setMargin( 0 ); area = new QScrollArea; layout->addWidget( area ); area->setFocusPolicy( Qt::TabFocus ); area->setFrameShape( QFrame::NoFrame ); updateMounts(); connect(sinfo, SIGNAL(disksChanged()), this, SLOT(updateMounts())); startTimer(60000); }
IndexWindow::IndexWindow() : m_searchLineEdit(0) , m_indexWidget(0) { QVBoxLayout *layout = new QVBoxLayout(this); m_searchLineEdit = new Utils::FilterLineEdit(); m_searchLineEdit->setPlaceholderText(QString()); setFocusProxy(m_searchLineEdit); connect(m_searchLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterIndices(QString))); m_searchLineEdit->installEventFilter(this); QLabel *l = new QLabel(tr("&Look for:")); l->setBuddy(m_searchLineEdit); layout->addWidget(l); layout->setMargin(0); layout->setSpacing(0); Utils::StyledBar *toolbar = new Utils::StyledBar(this); toolbar->setSingleRow(false); QLayout *tbLayout = new QHBoxLayout(); tbLayout->setSpacing(6); tbLayout->setMargin(4); tbLayout->addWidget(l); tbLayout->addWidget(m_searchLineEdit); toolbar->setLayout(tbLayout); layout->addWidget(toolbar); QHelpEngine *engine = &LocalHelpManager::helpEngine(); m_indexWidget = engine->indexWidget(); m_indexWidget->installEventFilter(this); connect(engine->indexModel(), SIGNAL(indexCreationStarted()), this, SLOT(disableSearchLineEdit())); connect(engine->indexModel(), SIGNAL(indexCreated()), this, SLOT(enableSearchLineEdit())); connect(m_indexWidget, SIGNAL(linkActivated(QUrl,QString)), this, SIGNAL(linkActivated(QUrl))); connect(m_indexWidget, SIGNAL(linksActivated(QMap<QString,QUrl>,QString)), this, SIGNAL(linksActivated(QMap<QString,QUrl>,QString))); connect(m_searchLineEdit, SIGNAL(returnPressed()), m_indexWidget, SLOT(activateCurrentItem())); m_indexWidget->setFrameStyle(QFrame::NoFrame); layout->addWidget(m_indexWidget); m_indexWidget->viewport()->installEventFilter(this); }
OptionsTiffImporter::OptionsTiffImporter(QWidget* pParent) : LabeledSectionGroup(pParent), mpDescriptor(NULL) { QWidget* pFileBrowserWidget = new QWidget(this); QLabel* pFileBrowserLabel = new QLabel("Select an ISD metadata file or leave blank for no ISD metadata:", pFileBrowserWidget); mpFilename = new FileBrowser(pFileBrowserWidget); mpFilename->setWhatsThis("<p>An ISD metadata file is an XML file shipped with some imagery such as Quickbird. " "It contains image metadata. If you have an ISD metadata file and would like to load it with the cube data, " "select it here. If you do not want to load an ISD metadata file, leave this field blank.</p>" "Currently, the following information is loaded from the ISD file:" "<ul><li>RPC00B" "<li>Image header information needed to use the RPC00B" "</ul>"); mpFilename->setBrowseCaption("Select ISD Metadata File"); mpFilename->setBrowseFileFilters("ISD Metadata Files (*.xml)"); mpFilename->setBrowseExistingFile(true); QGridLayout* pLayout = new QGridLayout(pFileBrowserWidget); pLayout->setMargin(0); pLayout->setSpacing(5); pLayout->addWidget(pFileBrowserLabel, 0, 0); pLayout->addWidget(mpFilename, 1, 0, 1, 2); pLayout->setColumnStretch(1, 5); LabeledSection* pFileBrowserSection = new LabeledSection(pFileBrowserWidget, "ISD Metadata File", this); // Layout QWidget* pWidget = widget(); if (pWidget != NULL) { QLayout* pLayout = pWidget->layout(); if (pLayout != NULL) { pLayout->setMargin(10); } } // Initialization addSection(pFileBrowserSection); addStretch(10); setSizeHint(300, 50); // Connections VERIFYNR(connect(mpFilename, SIGNAL(filenameChanged(const QString&)), this, SLOT(loadIsdMetadata(const QString&)))); }
void FieldGUIController::makeCellHoverSensitiveAndClicable(unsigned row, unsigned coll, const QString &hover_color) { QWidget *cell = getCell(row,coll); QLayout* layout = new QBoxLayout(QBoxLayout::LeftToRight,cell); layout->setSpacing(0); layout->setMargin(0); QWidgetWithPosClicked*hover_and_click = new QWidgetWithPosClicked(cell); //game cells numeration from 0 but in greedlayout from 1 hover_and_click->setPosOnField(row-1,coll-1); QObject::connect(hover_and_click,SIGNAL(clicked(uint,uint,Qt::MouseButton)),this,SLOT(clickCell(uint,uint,Qt::MouseButton))); QString style = "*{border-image: none; border: none; margin: 4px;} *:hover {border: 3px solid "+hover_color+";}"; hover_and_click->setStyleSheet(style); layout->addWidget(hover_and_click); cell->setLayout(layout); }
bool TextPlayer::playOn(const ValuePacket &values, QWidget *target, QString *errorStr) { m_UpdateTimer.stop(); m_CurrentTextPtr = 0; const QString& textFilePath = values.value(TextFilePathName, "").toString(); if(textFilePath == "") { m_Text = values.value(TextName, "").toString(); if(m_Text == "") { SetString(tr("得到文本文件路径或者直接文本失败"), errorStr); return false; } } else { QFile textFile(textFilePath); if(!textFile.open(QFile::ReadOnly)) { SetString(tr("打开播放文本出错"), errorStr); return false; } QByteArray bytes = textFile.readAll(); m_Text = QString::fromLocal8Bit(bytes.data()); } // this->setText(text); if(target != NULL) { target->setAutoFillBackground(true); QLayout* layout = target->layout(); if(layout == NULL) layout = new QHBoxLayout; layout->setMargin(1); layout->addWidget(this); target->setLayout(layout); } m_UpdateTimer.start(m_UpdateInterval); return true; }
void OptionsBrowser::addOption(LiteApi::IOption *opt) { if (!opt || !opt->widget()) { return; } QListWidgetItem *item = new QListWidgetItem; item->setIcon(opt->icon()); item->setText(opt->name()); item->setTextAlignment(Qt::AlignLeft);// | Qt::AlignHCenter); item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); QLayout *layout = opt->widget()->layout(); if (layout) { layout->setMargin(0); } ui->listWidget->addItem(item); ui->stackedWidget->addWidget(opt->widget()); m_widgetOptionMap.insert(item,opt); }
TCollapsibleWidget* KSettingsContainer::insertWidget(QWidget *w, const QString& name) { if (w && w->layout()) { QLayout *lay = w->layout(); lay->setMargin(2); lay->setSpacing(0); } TCollapsibleWidget *cw = new TCollapsibleWidget(name); k->layout->addWidget(cw); cw->setInnerWidget(w); k->collapsibles << cw; cw->show(); return cw; }
NotificationView::NotificationView(QObject* parent) : INotificationView(parent), m_pMainWidget( new QWidget), m_pQmlView( new QDeclarativeView()) { m_pMainWidget->setWindowFlags(Qt::ToolTip); m_pMainWidget->setAttribute(Qt::WA_TranslucentBackground); m_pMainWidget->setStyleSheet("background:transparent;"); QLayout* pL = new QHBoxLayout(m_pMainWidget); pL->setMargin(0); pL->addWidget(m_pQmlView); QString qmlPath = NotificationServerSettings::instance()->value("QmlNotification::QMLFile").toString(); TRACE("Default qml file is qmlPath=" << qmlPath.toStdString()); m_pQmlView->setSource(QUrl(qmlPath)); QObject* pO = m_pQmlView->rootObject(); connect( pO, SIGNAL(qmlRemoved(int)), this, SLOT(removedFromQml(int))); }
void MetaDataBase::setMargin( QObject *o, int margin ) { if ( !o ) return; setupDataBase(); MetaDataBaseRecord *r = db->find( (void*)o ); if ( !r || !o->isWidgetType() ) { qWarning( "No entry for %p (%s, %s) found in MetaDataBase", o, o->name(), o->className() ); return; } r->margin = margin; QLayout * layout = 0; WidgetFactory::layoutType( (QWidget*)o, layout ); if ( margin < 1 ) margin = 1; if ( layout ) layout->setMargin( margin ); }
FormPage::FormPage(FPage* fPage, QWidget* parent, ViewPage::ViewMode viewMode) : QWidget(parent) { Q_ASSERT(fPage); m_fPage = fPage; m_viewPage = new ViewPage(this, fPage, viewMode); QLayout* layout = NULL; if (viewMode == ViewPage::Design) { QGridLayout* gridLayout = new QGridLayout(this); gridLayout->setSizeConstraint(QLayout::SetMinimumSize); layout = gridLayout; QLabel* label = new QLabel(this); label->setText("*"); gridLayout->addWidget(label, 0, 0); Rule* hRule = new Rule(Qt::Horizontal, this); gridLayout->addWidget(hRule, 0, 1); Rule* vRule = new Rule(Qt::Vertical, this); gridLayout->addWidget(vRule, 1, 0); m_viewPage->setRules(hRule, vRule); gridLayout->addWidget(m_viewPage, 1, 1); } else { layout = new QVBoxLayout(this); layout->addWidget(m_viewPage); } layout->setSpacing(0); layout->setMargin(0); setLayout(layout); }
/** * @brief * Updates the transfer function */ void DockWidgetVolumeTransferFunction::UpdateObject(PLCore::Object *pObject) { // Destroy previous transfer function Qt widget if (m_pTransferFunctionWidget) { delete m_pTransferFunctionWidget; m_pTransferFunctionWidget = nullptr; } if (m_pTransferFunctionResultWidget) { delete m_pTransferFunctionResultWidget; m_pTransferFunctionResultWidget = nullptr; } // Is there an selected object? if (pObject) { // Get encapsulated Qt dock widget QDockWidget *pQDockWidget = GetQDockWidget(); if (pQDockWidget) { // Get the used volume resource PLVolume::Volume *pVolume = static_cast<PLVolume::SNVolume&>(*pObject).GetVolume(); // If we're in here, we know the cast is valid if (pVolume) { // Transfer function result widget m_pTransferFunctionResultWidget = new QLabel(); m_pTransferFunctionResultWidget->setAlignment(Qt::AlignTop | Qt::AlignLeft); m_pTransferFunctionResultWidget->setToolTip(pQDockWidget->tr("Resulting 1D transfer function")); // Create transfer function Qt widget m_pTransferFunctionWidget = new TransferFunctionWidget(*this, *pVolume); QLayout *pQLayout = new QVBoxLayout(); pQLayout->setSpacing(0); pQLayout->setMargin(0); pQLayout->setContentsMargins(0, 0, 0, 0); pQLayout->addWidget(m_pTransferFunctionWidget); pQLayout->addWidget(m_pTransferFunctionResultWidget); QWidget *pQWidget = new QWidget(); pQWidget->setLayout(pQLayout); pQDockWidget->setWidget(pQWidget); } } } }
void KeyTreeView::init() { KDAB_SET_OBJECT_NAME( m_proxy ); KDAB_SET_OBJECT_NAME( m_view ); if ( m_additionalProxy && m_additionalProxy->objectName().isEmpty() ) KDAB_SET_OBJECT_NAME( m_additionalProxy ); QLayout * layout = new QVBoxLayout( this ); KDAB_SET_OBJECT_NAME( layout ); layout->setMargin( 0 ); layout->addWidget( m_view ); HeaderView * headerView = new HeaderView( Qt::Horizontal ); KDAB_SET_OBJECT_NAME( headerView ); m_view->setHeader( headerView ); m_view->setSelectionBehavior( QAbstractItemView::SelectRows ); m_view->setSelectionMode( QAbstractItemView::ExtendedSelection ); //m_view->setAlternatingRowColors( true ); m_view->setAllColumnsShowFocus( true ); m_view->setSortingEnabled( true ); if ( model() ) { if ( m_additionalProxy ) m_additionalProxy->setSourceModel( model() ); else m_proxy->setSourceModel( model() ); } if ( m_additionalProxy ) { m_proxy->setSourceModel( m_additionalProxy ); if ( !m_additionalProxy->parent() ) m_additionalProxy->setParent( this ); } m_proxy->setFilterFixedString( m_stringFilter ); m_proxy->setKeyFilter( m_keyFilter ); m_view->setModel( m_proxy ); #ifdef KDEPIM_MOBILE_UI m_view->setFrameStyle( QFrame::NoFrame ); #endif }
TilesetDock::TilesetDock(QWidget *parent): QDockWidget(parent), mMapDocument(0), mTabBar(new QTabBar), mViewStack(new QStackedWidget), mCurrentTile(0), mCurrentTiles(0) { setObjectName(QLatin1String("TilesetDock")); QWidget *w = new QWidget(this); QLayout *l = new QVBoxLayout(w); l->setSpacing(0); l->setMargin(0); l->addWidget(mTabBar); l->addWidget(mViewStack); mTabBar->setTabsClosable(true); mTabBar->setMovable(true); mTabBar->setUsesScrollButtons(true); connect(mTabBar, SIGNAL(currentChanged(int)), mViewStack, SLOT(setCurrentIndex(int))); connect(mTabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(removeTileset(int))); connect(mTabBar, SIGNAL(tabMoved(int,int)), this, SLOT(moveTileset(int,int))); connect(mViewStack, SIGNAL(currentChanged(int)), this, SLOT(updateCurrentTiles())); connect(TilesetManager::instance(), SIGNAL(tilesetChanged(Tileset*)), this, SLOT(tilesetChanged(Tileset*))); setWidget(w); retranslateUi(); setAcceptDrops(true); }
GroupTab::GroupTab(QWidget *parent) : Tab(parent){ // Populate online list container QWidget *onlineContainer = new QWidget; QLayout *onlineContainerLayout = new QVBoxLayout(); online = new QListWidget; online->setSortingEnabled(true); onlineContainer->setMinimumWidth(50); onlineContainer->setMaximumWidth(175); onlineContainerLayout->addWidget(new QLabel("Online:")); onlineContainerLayout->addWidget(online); onlineContainerLayout->setMargin(0); onlineContainerLayout->setSpacing(2); onlineContainer->setLayout(onlineContainerLayout); // Enable double clicking on list items to message peer connect(online,SIGNAL(itemDoubleClicked(QListWidgetItem*)),parent,SLOT(startPeerChat(QListWidgetItem*))); outputSplitter->addWidget(onlineContainer); outputSplitter->setStretchFactor(0,7); outputSplitter->setStretchFactor(1,3); // Set base hue hueSeed = 0; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { _currentKeyboard = 0; _mainLayout = new QVBoxLayout; _mainLayout->setSpacing(0); _mainLayout->setMargin(0); _mainLayout->setContentsMargins(10,10,10,0); QWidget *centralWidget = new QWidget; centralWidget->setLayout(_mainLayout); this->setCentralWidget(centralWidget); // create labels Label * label = new Label(2); label->setObjectName("2"); _labels[label->objectName()] = label; connect(label, SIGNAL(selected()), this, SLOT(labelSelected())); _mainLayout->addWidget(label); // second row: UInt16 Hex QWidget *row = new QWidget; QLayout *rowLayout = new QHBoxLayout; rowLayout->setSpacing(0); rowLayout->setMargin(0); row->setLayout(rowLayout); _mainLayout->addWidget(row); label = new Label(10); label->setObjectName("10"); _labels[label->objectName()] = label; connect(label, SIGNAL(selected()), this, SLOT(labelSelected())); row->layout()->addWidget(label); label = new Label(16); label->setObjectName("16"); _labels[label->objectName()] = label; connect(label, SIGNAL(selected()), this, SLOT(labelSelected())); row->layout()->addWidget(label); // third row: Octal Char row = new QWidget; rowLayout = new QHBoxLayout; rowLayout->setSpacing(0); rowLayout->setMargin(0); row->setLayout(rowLayout); _mainLayout->addWidget(row); label = new Label(8); label->setObjectName("8"); _labels[label->objectName()] = label; connect(label, SIGNAL(selected()), this, SLOT(labelSelected())); row->layout()->addWidget(label); label = new CharLabel(); _labels["Char"] = label; connect(label, SIGNAL(selected()), this, SLOT(labelSelected())); row->layout()->addWidget(label); // keyboard box widget _keyboardBoxWidget = new QWidget; QLayout * keyboardBoxLayout = new QGridLayout; keyboardBoxLayout->setSpacing(0); keyboardBoxLayout->setMargin(0); keyboardBoxLayout->setContentsMargins(0,0,0,0); _keyboardBoxWidget->setLayout(keyboardBoxLayout); _keyboardBoxWidget->setFixedHeight(200); _mainLayout->addWidget(_keyboardBoxWidget); // keyboards Keyboard *keyboard = new Keyboard(16, 3); keyboard->setObjectName("16"); connect(keyboard, SIGNAL(pressedButton(QString)), this, SLOT(pressedButton(QString))); _keyboards[keyboard->objectName()] = keyboard; keyboard = new Keyboard(8, 3); keyboard->setObjectName("8"); connect(keyboard, SIGNAL(pressedButton(QString)), this, SLOT(pressedButton(QString))); _keyboards[keyboard->objectName()] = keyboard; keyboard = new Keyboard(10, 3); keyboard->setObjectName("10"); connect(keyboard, SIGNAL(pressedButton(QString)), this, SLOT(pressedButton(QString))); _keyboards[keyboard->objectName()] = keyboard; keyboard = new Keyboard(2, 2); keyboard->setObjectName("2"); connect(keyboard, SIGNAL(pressedButton(QString)), this, SLOT(pressedButton(QString))); _keyboards[keyboard->objectName()] = keyboard; setKeyboard(tr("10")); updateLabels(); }
SingleConnectorInfoWidget::SingleConnectorInfoWidget(ConnectorsInfoWidget *topLevelContainer, WaitPushUndoStack *undoStack, Connector* connector, QWidget *parent) : AbstractConnectorInfoWidget(topLevelContainer,parent) { static QString EMPTY_CONN_NAME = QObject::tr("no name yet"); static QString EMPTY_CONN_DESC = QObject::tr("no description yet"); static Connector::ConnectorType EMPTY_CONN_TYPE = Connector::Male; QString name; QString description; Connector::ConnectorType type; m_undoStack = undoStack; m_connector = connector; if(connector && connector->connectorShared()) { m_id = connector->connectorSharedID(); name = connector->connectorSharedName(); if (name.isEmpty()) name = EMPTY_CONN_NAME; description = connector->connectorSharedDescription(); if (description.isEmpty()) description = EMPTY_CONN_DESC; type = connector->connectorType(); if (type == Connector::Unknown) type = EMPTY_CONN_TYPE; } else { name = EMPTY_CONN_NAME; description = EMPTY_CONN_DESC; type = EMPTY_CONN_TYPE; } m_nameLabel = new QLabel(name,this); m_nameDescSeparator = new QLabel(" - ",this); m_descLabel = new QLabel(description,this); m_descLabel->setObjectName("description"); m_type = new ConnectorTypeWidget(type, this); m_nameEdit = NULL; m_descEdit = NULL; m_nameEditContainer = new QFrame(this); QHBoxLayout *nameLO = new QHBoxLayout(m_nameEditContainer); nameLO->setSpacing(0); nameLO->setMargin(0); m_nameEditContainer->hide(); m_descEditContainer = new QFrame(this); QVBoxLayout *descLO = new QVBoxLayout(m_descEditContainer); descLO->setSpacing(0); descLO->setMargin(0); m_descEditContainer->hide(); m_acceptButton = NULL; m_cancelButton = NULL; setSelected(false); QLayout *layout = new QVBoxLayout(this); layout->setMargin(1); toStandardMode(); }
MainWindowMobile::MainWindowMobile(QWidget * parent) : PlugGui::Container(parent) , m_networkAccessManager(new QNetworkAccessManager) , m_pictureSearch(0) , m_sceneView(0) , m_topbarContainer(0) { // setup widget applianceSetTitle(QString()); // vertical layout QVBoxLayout * mainLayout = new QVBoxLayout(this); mainLayout->setMargin(0); mainLayout->setSpacing(0); // container for the navigation bar QWidget * nbContainer = new NavibarContainer(this); mainLayout->addWidget(nbContainer); QLayout * nbLayout = new QHBoxLayout(nbContainer); nbLayout->setMargin(0); // create the Workflow navigation bar BreadCrumbBar * workflowBar = new BreadCrumbBar(nbContainer); workflowBar->setObjectName(QString::fromUtf8("applianceNavBar")); workflowBar->setClickableLeaves(false); workflowBar->setBackgroundOffset(-1); nbLayout->addWidget(workflowBar); workflowBar->show(); nbLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding)); // create the exit button on the right side BreadCrumbBar * exitBar = new BreadCrumbBar(nbContainer); connect(exitBar, SIGNAL(nodeClicked(quint32)), qApp, SLOT(quit())); exitBar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Ignored); exitBar->setBackgroundOffset(1); exitBar->addNode(1, tr("Exit"), 0); nbLayout->addWidget(exitBar); exitBar->show(); // create the Help navigation bar /*BreadCrumbBar * helpBar = new BreadCrumbBar(m_sceneView); connect(helpBar, SIGNAL(nodeClicked(quint32)), this, SLOT(slotHelpBarClicked(quint32))); helpBar->setBackgroundOffset(1); helpBar->addNode(1, tr(" ? "), 0); helpBar->show(); addNavigationWidget(helpBar, 0, Qt::AlignRight);*/ // the scene view, where applicances will plug into! m_sceneView = new SceneView(this); mainLayout->addWidget(m_sceneView); m_sceneView->setFrameShape(QFrame::NoFrame); // the topbar container, populated by the framework m_topbarContainer = new TopbarContainer(m_sceneView); m_topbarContainer->setFixedHeight(App::TopBarHeight); m_topbarContainer->show(); QHBoxLayout * topbarLayout = new QHBoxLayout(m_topbarContainer); topbarLayout->setMargin(0); topbarLayout->setSpacing(0); // show (with last geometry) showFullScreen(); // start the workflow new Workflow((PlugGui::Container *)this, workflowBar); // create the online services new OnlineServices(m_networkAccessManager); // focus the scene applianceSetFocusToScene(); #if 0 // start with the Help appliance the first time if (App::settings->firstTime()) App::workflow->stackHelpAppliance(); #endif }