EditorTab::EditorTab(WebFile* file, QWidget* parent) : QSplitter(parent) { m_options = OptionStore::getInstance(); m_listmodel =new QStringListModel; m_documentList = new QList<QTextDocument*>; TextEditor* textedit = new TextEditor(this);//qobject_cast<TextEditor*>(m_editor->widget()); if(file) connect(textedit,SIGNAL(textChanged()),file,SLOT(hasBeenModified())); p = new PhpHighLighter(textedit->document()); connect(m_options,SIGNAL(fontChanged(QFont)),textedit,SLOT(setCurrentFont(QFont))); textedit->setCurrentFont(m_options->font()); m_leftcolumn = new QSplitter(Qt::Vertical,this); ProjectFilesBrowser* tmpBrowser=new ProjectFilesBrowser(); m_view = new FancyWidget(tmpBrowser); m_leftcolumn->addWidget(m_view->widget()); addWidget(m_leftcolumn); setStretchFactor(0,1); addEditor(textedit); setStretchFactor(1,3); }
LocalsAndInspectorWindow::LocalsAndInspectorWindow(QWidget *locals, QWidget *inspector, QWidget *returnWidget) : m_showLocals(false) { auto layout = new QVBoxLayout(this); layout->setMargin(0); layout->setSpacing(0); auto splitter = new Core::MiniSplitter(Qt::Vertical); layout->addWidget(splitter); auto localsAndInspector = new QStackedWidget; localsAndInspector->addWidget(locals); localsAndInspector->addWidget(inspector); localsAndInspector->setCurrentWidget(inspector); splitter->addWidget(localsAndInspector); splitter->addWidget(returnWidget); splitter->setStretchFactor(0, 3); splitter->setStretchFactor(2, 1); splitter->setStretchFactor(3, 1); // Timer is to prevent flicker when switching between Inpector and Locals // when debugger engine changes states. m_timer.setSingleShot(true); m_timer.setInterval(500); // TODO: remove the magic number! connect(&m_timer, &QTimer::timeout, [this, localsAndInspector] { localsAndInspector->setCurrentIndex(m_showLocals ? LocalsIndex : InspectorIndex); }); }
void IrcClient::createBufferList() { bufferModel = new IrcBufferModel(connection); connect(bufferModel, SIGNAL(added(IrcBuffer*)), this, SLOT(onBufferAdded(IrcBuffer*))); connect(bufferModel, SIGNAL(removed(IrcBuffer*)), this, SLOT(onBufferRemoved(IrcBuffer*))); bufferList = new QListView(this); bufferList->setFocusPolicy(Qt::NoFocus); bufferList->setModel(bufferModel); // keep the command parser aware of the context connect(bufferModel, SIGNAL(channelsChanged(QStringList)), parser, SLOT(setChannels(QStringList))); // keep track of the current buffer, see also onBufferActivated() connect(bufferList->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(onBufferActivated(QModelIndex))); // create a server buffer for non-targeted messages... IrcBuffer* serverBuffer = bufferModel->add(connection->host()); // ...and connect it to IrcBufferModel::messageIgnored() connect(bufferModel, SIGNAL(messageIgnored(IrcMessage*)), serverBuffer, SLOT(receiveMessage(IrcMessage*))); insertWidget(0, bufferList); setStretchFactor(0, 1); setStretchFactor(1, 3); }
PropertyWindow::PropertyWindow(QWidget *proxyParent, MainWindow *parent) : QSplitter(proxyParent), _parent(*parent), _scene(nullptr), _selection(parent->selection()), _openTab(0) { _sceneTree = new QTreeWidget(this); _sceneTree->setSelectionMode(QAbstractItemView::ExtendedSelection); _sceneTree->setHeaderHidden(true); _propertyTabs = new QTabWidget(this); addWidget(_sceneTree); addWidget(_propertyTabs); setOrientation(Qt::Vertical); setStretchFactor(0, 0); setStretchFactor(1, 1); setFocusPolicy(Qt::StrongFocus); connect(_sceneTree, SIGNAL(itemSelectionChanged()), this, SLOT(treeSelectionChanged())); connect(_propertyTabs, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int))); }
KviUIntSelector::KviUIntSelector(QWidget * par,const QString & txt,unsigned int *pOption, unsigned int uLowBound,unsigned int uHighBound,unsigned int uDefault,bool bEnabled,bool bShortInt) : KviTalHBox(par), KviSelectorInterface() { m_pLabel = new QLabel(txt,this); //m_pLineEdit = new QLineEdit(this); //m_pLineEdit->setMaximumWidth(150); m_pSpinBox = new QSpinBox(this); m_bIsShortInt = bShortInt; setEnabled(bEnabled); m_pOption = pOption; m_uLowBound = uLowBound; m_uHighBound = uHighBound; m_uDefault = uDefault; m_pSpinBox->setMinimum(m_uLowBound); m_pSpinBox->setMaximum(m_uHighBound); //KviCString tmp(KviCString::Format,"%u",bShortInt ? (unsigned int) *((unsigned short int *)pOption) : *pOption); //m_pLineEdit->setText(tmp.ptr()); m_pSpinBox->setValue(bShortInt ? (unsigned int) *((unsigned short int *)pOption) : *pOption); setSpacing(4); setStretchFactor(m_pLabel,1); }
Route::Route(QWidget *parent, Core *core) : QSplitter(parent) { this->core = core; // Machine tree QTreeView *routeTree = new QTreeView(this); routeTree->setModel(core->gearsTree); routeTree->model()->setHeaderData(0, Qt::Horizontal, tr("Machines")); connect(routeTree, SIGNAL(doubleClicked(QModelIndex)), SLOT(newMachine(QModelIndex))); // Editor routeScene = new QGraphicsScene(this); routeScene->setSceneRect(0, 0, 1440, 768); routeEditor = new QGraphicsView(routeScene, this); routeEditor->setRenderHints(QPainter::Antialiasing); routeEditor->centerOn(0, 0); extraline = new QGraphicsPathItem(); extraline->hide(); routeScene->addItem(extraline); // Layout addWidget(routeTree); addWidget(routeEditor); setStretchFactor(1, 1); }
FramestackWidget::FramestackWidget(IDebugController* controller, QWidget* parent) : QSplitter(Qt::Horizontal, parent), m_session(0) { connect(controller, SIGNAL(currentSessionChanged(KDevelop::IDebugSession*)), SLOT(currentSessionChanged(KDevelop::IDebugSession*))); connect(controller, SIGNAL(raiseFramestackViews()), SIGNAL(requestRaise())); setWhatsThis(i18n("<b>Frame stack</b><p>" "Often referred to as the \"call stack\", " "this is a list showing which function is " "currently active, and what called each " "function to get to this point in your " "program. By clicking on an item you " "can see the values in any of the " "previous calling functions.</p>")); setWindowIcon(KIcon("view-list-text")); m_threadsWidget = new QWidget(this); m_threads = new QListView(m_threadsWidget); m_frames = new QTreeView(this); m_frames->setRootIsDecorated(false); m_threadsWidget->setLayout(new QVBoxLayout()); m_threadsWidget->layout()->addWidget(new QLabel(i18n("Threads:"))); m_threadsWidget->layout()->addWidget(m_threads); m_threadsWidget->hide(); addWidget(m_threadsWidget); addWidget(m_frames); setStretchFactor(1, 3); connect(m_frames->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(checkFetchMoreFrames())); connect(m_threads, SIGNAL(clicked(QModelIndex)), this, SLOT(setThreadShown(QModelIndex))); connect(m_frames, SIGNAL(clicked(QModelIndex)), SLOT(frameClicked(QModelIndex))); }
////////////////////////////////////////////////////////////////////////////////////////// /// DynamicBar ////////////////////////////////////////////////////////////////////////////////////////// DynamicBar::DynamicBar(QWidget* parent) : QHBox( parent, "DynamicModeStatusBar" ) { m_titleWidget = new DynamicTitle(this); setSpacing( KDialog::spacingHint() ); QWidget *spacer = new QWidget( this ); setStretchFactor( spacer, 10 ); }
void Dialog::createWidget() { createdWidgetx = true; dgReadByUser = false; int w = smiles->size().width() / W_CNT; int h = smiles->size().height() / H_CNT; lwHistory = new QListWidget(); teMessage = new TextEditMessage(); //teHistory->setReadOnly(true); addWidget(lwHistory); setStretchFactor(0, 2); panel = new QToolBar(); QIcon newIcon = QPixmap::fromImage(smiles->copy(w, 0, w, h)); QAction *a = new QAction(newIcon, QString("&Smiles"), 0); a->setPriority(QAction::LowPriority); a->setShortcut(Qt::CTRL + Qt::Key_S); connect(a, SIGNAL(triggered()), this, SLOT(slotClickedSmileMenu())); panel->addAction(a); panel->setFixedHeight(30); //panel->pos() /*QMenuBar *panel = new QMenuBar(this); panel->setFixedHeight(30); panel->setAutoFillBackground(true); panel->setStyleSheet("QMenuBar { background-color: #f3f2f1; } QMenuBar::item { background-color: #f3f2f1; }"); //panel->setStyleSheet("QMenuBar::item { icon-size: 32px; } "); //panel->setStyleSheet("QMenuBar::button { background-color: #ffffff; }");*/ addWidget(panel); addWidget(teMessage); smileMenu = new QMenu("Smiles"); smileMenu->setIcon(QPixmap::fromImage(smiles->copy(w, 0, w, h))); smileMenu->setStyleSheet("QMenu { background-color: #ffffff;}"); QGridLayout *lytSmiles = new QGridLayout(smileMenu); QPalette palw; palw.setBrush(smileMenu->backgroundRole(), Qt::white); smileMenu->setAutoFillBackground(true); smileMenu->setPalette(palw); for (int i = 0; i < W_CNT; ++i) for (int j = 0; j < H_CNT; ++j) { QImage icon = smiles->copy(j * w, i * h, w, h); SmileButton *but = new SmileButton(icon, W_CNT * i + j); connect(but, SIGNAL(clicked()), this, SLOT(slotSmilesClicked())); lytSmiles->addWidget(but, i, j); //teMessage->document()->addResource(QTextDocument::ImageResource, QUrl(but->name()), smiles->copy(j * w, i * h, w, h)); //teHistory->document()->addResource(QTextDocument::ImageResource, QUrl(but->name()), smiles->copy(j * w, i * h, w, h)); } reloadResource(message()); smileMenu->setFixedSize(lytSmiles->sizeHint()); lwHistory->scrollToBottom(); connect(&tmrNotActive, SIGNAL(timeout()), this, SLOT(slotNotActiveBehav())); connect(teMessage, SIGNAL(gotFocus()), this, SLOT(slotFinishReadMessage())); connect(teMessage, SIGNAL(lostFocus()), this, SLOT(slotNotActiveBehav())); }
WLayoutChatLog::WLayoutChatLog(ITreeItemChatLogEvents * pContactOrGroupParent) { Assert(pContactOrGroupParent != NULL); m_pContactOrGroup_NZ = pContactOrGroupParent; m_pContactParent_YZ = (pContactOrGroupParent->EGetRuntimeClass() == RTI(TContact)) ? (TContact *)pContactOrGroupParent : NULL; m_pwFindText = NULL; m_tidChatStateComposing = d_zNA; #ifdef COMPILE_WITH_CHATLOG_HTML m_pwChatLog_NZ = new WChatLogHtml(this, pContactOrGroupParent); #else m_pwChatLog_NZ = new WChatLog(this, pContactOrGroupParent); #endif setStretchFactor(0, 5); /* if (pContactParent_YZ != NULL) { if (pContactParent_YZ->m_uFlagsContact & TContact::FC_kfContactNeedsInvitation) WidgetContactInvitation_Show(); if (pContactParent_YZ->m_uFlagsContact & TContact::FC_kfContactUnsolicited) Layout_NoticeAuxiliaryAdd(PA_DELETING new WNoticeContactUnsolicited(pContactParent_YZ)); } */ m_pwChatInput = new WChatInput(this); QWidget * pWidget = new QWidget(this); // pWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); OLayoutHorizontal * pLayoutMessageInput = new OLayoutHorizontal(pWidget); pLayoutMessageInput->setContentsMargins(0, 0, 5, 0); pLayoutMessageInput->addWidget(m_pwChatInput); OLayoutVertical * pLayoutButtons = new OLayoutVerticalAlignTop(pLayoutMessageInput); pLayoutButtons->setSpacing(0); m_pwButtonSendBitcoin = new WButtonIconForToolbar(eMenuIcon_Bitcoin, "Send Bitcoins"); pLayoutButtons->addWidget(m_pwButtonSendBitcoin); connect(m_pwButtonSendBitcoin, SIGNAL(clicked()), this, SLOT(SL_ButtonSendBitcoin())); WButtonIconForToolbar * pwButton = new WButtonIconForToolbar(eMenuIcon_FileUpload, "Send File\n\nYou may drag and drop the file, or copy & paste the file from Windows Explorer"); pLayoutButtons->addWidget(pwButton); connect(pwButton, SIGNAL(clicked()), this, SLOT(SL_ButtonSendFile())); pwButton = new WButtonIconForToolbar(eMenuIcon_ContactAdd, "Add people to the converstation"); pLayoutButtons->addWidget(pwButton); connect(pwButton, SIGNAL(clicked()), this, SLOT(SL_ButtonAddContacts())); pwButton = new WButtonIconForToolbar(eMenuIcon_Vote, "Send a ballot to the group to vote"); pLayoutButtons->addWidget(pwButton); connect(pwButton, SIGNAL(clicked()), this, SLOT(SL_ButtonSendBallot())); setChildrenCollapsible(false); // Do not allow the widget WChatInput() to collapse; it would be very confusing to the user // addWidget(PA_CHILD m_pwChatLog); //addWidget(PA_CHILD new WFindText(m_pwChatLog->document())); // addWidget(PA_CHILD m_pwChatInput); setAcceptDrops(true); }
ModuleWidget::ModuleWidget(QWidget *parent, const char *name) : QVBox(parent, name) { QHBox *titleLine = new QHBox(this, "titleLine"); m_title = new ModuleTitle(titleLine, "m_title"); QPushButton *helpButton = new QPushButton(titleLine); helpButton->setIconSet(SmallIconSet("help")); connect(helpButton, SIGNAL(clicked()), this, SIGNAL(helpRequest())); m_body = new QVBox(this, "m_body"); setStretchFactor(m_body, 10); }
SlotInspectorSection::SlotInspectorSection( const QString& name, const SlotModel& slot, RackInspectorSection* parentRack) : InspectorSectionWidget {name, false, parentRack}, m_model {slot}, m_parent{parentRack->constraintInspector()} { auto framewidg = new QFrame; auto lay = new iscore::MarginLess<QVBoxLayout>(framewidg); framewidg->setFrameShape(QFrame::StyledPanel); addContent(framewidg); this->showMenu(true); auto del = this->menu()->addAction(tr("Remove Slot")); connect(del, &QAction::triggered, this, [=] () { auto cmd = new Command::RemoveSlotFromRack{m_model}; emit m_parent.commandDispatcher()->submitCommand(cmd); }); // View model list m_lmSection = new InspectorSectionWidget{"Process View Models", false, this}; m_lmSection->setObjectName("LayerModels"); m_model.layers.added.connect<SlotInspectorSection, &SlotInspectorSection::on_layerModelCreated>(this); m_model.layers.removed.connect<SlotInspectorSection, &SlotInspectorSection::on_layerModelRemoved>(this); // add indention in section auto indentWidg = new QWidget{this}; auto indentLay = new iscore::MarginLess<QHBoxLayout>{indentWidg}; indentLay->addWidget(new Inspector::VSeparator{this}); indentLay->addWidget(m_lmSection); indentLay->setStretchFactor(m_lmSection, 10); m_addLmWidget = new AddLayerModelWidget{this}; lay->addWidget(indentWidg); lay->addWidget(m_addLmWidget); auto frame = new QFrame{this}; m_lmGridLayout = new iscore::MarginLess<QGridLayout>{frame}; frame->setFrameShape(QFrame::StyledPanel); m_lmSection->addContent(frame); connect(this, &InspectorSectionWidget::nameChanged, this, &SlotInspectorSection::ask_changeName); for(const auto& lm : m_model.layers) { displayLayerModel(lm); } }
ModuleTitle::ModuleTitle(QWidget *parent, const char *name) : QHBox(parent, name) { QWidget *spacer = new QWidget(this); spacer->setFixedWidth(KDialog::marginHint() - KDialog::spacingHint()); m_icon = new QLabel(this); m_name = new QLabel(this); QFont font = m_name->font(); font.setPointSize(font.pointSize() + 1); font.setBold(true); m_name->setFont(font); setSpacing(KDialog::spacingHint()); if(QApplication::reverseLayout()) { spacer = new QWidget(this); setStretchFactor(spacer, 10); } else setStretchFactor(m_name, 10); }
RackInspectorSection::RackInspectorSection( const QString& name, const RackModel& rack, const ConstraintInspectorWidget& parentConstraint, QWidget* parent) : InspectorSectionWidget {name, false, parent}, m_parent{parentConstraint}, m_model {rack} { auto framewidg = new QFrame; auto lay = new iscore::MarginLess<QVBoxLayout> {framewidg}; framewidg->setFrameShape(QFrame::StyledPanel); addContent(framewidg); this->showMenu(true); auto del = this->menu()->addAction(tr("Remove Rack")); del->setIcon(genIconFromPixmaps(QString(":/icons/delete_on.png"), QString(":/icons/delete_off.png"))); connect(del, &QAction::triggered, this, [=] () { auto cmd = new Command::RemoveRackFromConstraint{ m_parent.model(), m_model.id()}; emit m_parent.commandDispatcher()->submitCommand(cmd); }); // Slots m_slotSection = new InspectorSectionWidget{"Slots", false, this}; // TODO Make a custom widget. m_slotSection->setObjectName("Slots"); m_model.slotmodels.added.connect<RackInspectorSection, &RackInspectorSection::on_slotCreated>(this); m_model.slotmodels.removed.connect<RackInspectorSection, &RackInspectorSection::on_slotRemoved>(this); for(const auto& slot : m_model.slotmodels) { addSlotInspectorSection(slot); } // add indention in section auto indentWidg = new QWidget{this}; auto indentLay = new iscore::MarginLess<QHBoxLayout> {indentWidg}; indentLay->addWidget(new Inspector::VSeparator{this}); indentLay->addWidget(m_slotSection); indentLay->setStretchFactor(m_slotSection, 10); m_slotWidget = new AddSlotWidget{this}; lay->addWidget(indentWidg); lay->addWidget(m_slotWidget); connect(this, &InspectorSectionWidget::nameChanged, this, &RackInspectorSection::ask_changeName); }
KviMircTextColorSelector::KviMircTextColorSelector(QWidget * par,const QString &txt,unsigned int * uFore,unsigned int * uBack,bool bEnabled) : KviTalHBox(par), KviSelectorInterface() { m_pLabel = new QLabel(txt,this); m_pButton = new QPushButton(__tr2qs("Sample Text"),this); // m_pButton->setMinimumWidth(150); connect(m_pButton,SIGNAL(clicked()),this,SLOT(buttonClicked())); setSpacing(4); setStretchFactor(m_pLabel,1); m_pUFore = uFore; m_pUBack = uBack; m_uBack = *uBack; m_uFore = *uFore; setButtonPalette(); setEnabled(bEnabled); m_pContextPopup = new QMenu(this); QAction *pAction = 0; m_pForePopup = new QMenu(this); connect(m_pForePopup,SIGNAL(triggered(QAction*)),this,SLOT(foreSelected(QAction*))); int iColor; for(iColor=0;iColor<KVI_MIRCCOLOR_MAX_FOREGROUND;iColor++) { QPixmap tmp(120,16); tmp.fill(KVI_OPTION_MIRCCOLOR(iColor)); pAction = m_pForePopup->addAction(tmp,QString("x")); pAction->setData(iColor); } pAction = m_pContextPopup->addAction(__tr2qs("Foreground")); pAction->setMenu(m_pForePopup); m_pBackPopup = new QMenu(this); connect(m_pBackPopup,SIGNAL(triggered(QAction*)),this,SLOT(backSelected(QAction*))); pAction = m_pBackPopup->addAction(__tr2qs("Transparent")); pAction->setData(KviControlCodes::Transparent); for(iColor=0;iColor<KVI_MIRCCOLOR_MAX_BACKGROUND;iColor++) { QPixmap tmp(120,16); tmp.fill(KVI_OPTION_MIRCCOLOR(iColor)); pAction = m_pBackPopup->addAction(tmp,QString("x")); pAction->setData(iColor); } pAction = m_pContextPopup->addAction(__tr2qs("Background")); pAction->setMenu(m_pBackPopup); }
bool WBoxLayout::setStretchFactor(WLayout *layout, int stretch) { for (int i = 0; i < count(); ++i) { WLayoutItem *item = itemAt(i); if (item && item->layout() == layout) { setStretchFactor(i, stretch); return true; } } return false; }
AlbumBreadcrumbWidget::AlbumBreadcrumbWidget( const Meta::AlbumPtr album, QWidget *parent ) : KHBox( parent ) , m_album( album ) { const KIcon artistIcon = KIcon( "filename-artist-amarok" ); const KIcon albumIcon = KIcon( "filename-album-amarok" ); new BreadcrumbItemMenuButton( this ); m_artistButton = new BreadcrumbItemButton( artistIcon, QString(), this ); new BreadcrumbItemMenuButton( this ); m_albumButton = new BreadcrumbItemButton( albumIcon, QString(), this ); QWidget *spacer = new QWidget( this ); setStretchFactor( m_artistButton, 1 ); setStretchFactor( m_albumButton, 1 ); setStretchFactor( spacer, 1 ); connect( m_artistButton, SIGNAL(clicked()), SLOT(artistClicked()) ); connect( m_albumButton, SIGNAL(clicked()), SLOT(albumClicked()) ); updateBreadcrumbs(); }
TransactionItem::TransactionItem( QWidget* parent, ProgressItem *item, bool first ) : QVBox( parent, "TransactionItem" ), mCancelButton( 0 ), mItem( item ) { setSpacing( 2 ); setMargin( 2 ); setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ) ); mFrame = new QFrame( this ); mFrame->setFrameShape( QFrame::HLine ); mFrame->setFrameShadow( QFrame::Raised ); mFrame->show(); setStretchFactor( mFrame, 3 ); QHBox *h = new QHBox( this ); h->setSpacing( 5 ); mItemLabel = new QLabel( item->label(), h ); // always interpret the label text as RichText, but disable word wrapping mItemLabel->setTextFormat( Qt::RichText ); mItemLabel->setAlignment( Qt::AlignAuto | Qt::AlignVCenter | Qt::SingleLine ); h->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ) ); mProgress = new QProgressBar( 100, h ); mProgress->setProgress( item->progress() ); if ( item->canBeCanceled() ) { mCancelButton = new QPushButton( SmallIcon( "cancel" ), QString::null, h ); QToolTip::add( mCancelButton, i18n("Cancel this operation.") ); connect ( mCancelButton, SIGNAL( clicked() ), this, SLOT( slotItemCanceled() )); } h = new QHBox( this ); h->setSpacing( 5 ); h->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ) ); mSSLLabel = new SSLLabel( h ); mSSLLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); mItemStatus = new QLabel( item->status(), h ); // always interpret the status text as RichText, but disable word wrapping mItemStatus->setTextFormat( Qt::RichText ); mItemStatus->setAlignment( Qt::AlignAuto | Qt::AlignVCenter | Qt::SingleLine ); // richtext leads to sizeHint acting as if wrapping was enabled though, // so make sure we only ever have the height of one line. mItemStatus->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Ignored ) ); mItemStatus->setFixedHeight( mItemLabel->sizeHint().height() ); setCrypto( item->usesCrypto() ); if( first ) hideHLine(); }
void MemberBrowserWidget::setup(Object* obj, PropertyBrowser *propBrowser, MethodBrowser *methodBrowser) { m_Object = obj; if (m_Object != NULL) { QWidget *propWidget = propBrowser->makeEditor(this, obj); propWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); addWidget(propWidget); if (m_Object->getInstanceClass()->getNumMethods() > 0) { QWidget *methodWidget = methodBrowser->makeEditor(this, obj); methodWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); addWidget(methodWidget); setStretchFactor(0,1); setCollapsible(0,false); setStretchFactor(1,0); setCollapsible(1,false); //if (methodWidget->height() > 200) { // QList<int> sizes; // sizes.append(height()-200); // sizes.append(200); // setSizes(sizes); //} } } }
KviPasswordLineEdit::KviPasswordLineEdit(QWidget * par) : KviTalHBox(par) { setSpacing(0); setMargin(0); m_pLineEdit = new QLineEdit(this); addSpacing(4); m_pCheckBox = new QCheckBox(this); m_pLineEdit->setEchoMode(QLineEdit::Password); m_pCheckBox->setCheckState(Qt::Checked); connect(m_pCheckBox,SIGNAL(stateChanged(int)), this, SLOT(checkToggled(int))); //m_pLineEdit->setMinimumWidth(200); setStretchFactor(m_pLineEdit,1); }
void GraphicsLinearLayoutObject::insertLayoutItem(int index, QGraphicsLayoutItem *item) { insertItem(index, item); if (LinearLayoutAttached *obj = attachedProperties.value(item)) { setStretchFactor(item, obj->stretchFactor()); setAlignment(item, obj->alignment()); updateSpacing(item, obj->spacing()); QObject::connect(obj, SIGNAL(stretchChanged(QGraphicsLayoutItem*,int)), this, SLOT(updateStretch(QGraphicsLayoutItem*,int))); QObject::connect(obj, SIGNAL(alignmentChanged(QGraphicsLayoutItem*,Qt::Alignment)), this, SLOT(updateAlignment(QGraphicsLayoutItem*,Qt::Alignment))); QObject::connect(obj, SIGNAL(spacingChanged(QGraphicsLayoutItem*,int)), this, SLOT(updateSpacing(QGraphicsLayoutItem*,int))); }
KviStringSelector::KviStringSelector(QWidget * par,const QString & txt,QString * pOption,bool bEnabled) : KviTalHBox(par), KviSelectorInterface() { m_pLabel = new QLabel(txt,this); m_pLineEdit = new QLineEdit(this); //m_pLineEdit->setMinimumWidth(200); QString tmp = *pOption; m_pLineEdit->setText(tmp); setSpacing(4); setStretchFactor(m_pLineEdit,1); m_pOption = pOption; setEnabled(bEnabled); }
void SubTabView::createLayout() { auto leftWidget = new QWidget(); addWidget(leftWidget); auto outerLeftVLayout = new QVBoxLayout(); outerLeftVLayout->setContentsMargins(0, 0, 0, 0); outerLeftVLayout->setSpacing(0); leftWidget->setLayout(outerLeftVLayout); outerLeftVLayout->addWidget(m_itemSelector, 10); outerLeftVLayout->addWidget(m_itemSelectorButtons); addWidget(m_inspectorView); setStretchFactor(1, 100000); }
KviFontSelector::KviFontSelector(QWidget * par,const QString & txt,QFont * pOption,bool bEnabled) : KviTalHBox(par), KviSelectorInterface() { m_pLabel = new QLabel(txt,this); m_pButton = new QPushButton("",this); // m_pButton->setMinimumWidth(150); connect(m_pButton,SIGNAL(clicked()),this,SLOT(changeClicked())); setSpacing(4); setStretchFactor(m_pLabel,1); setButtonFont(pOption); m_pOption = pOption; setEnabled(bEnabled); }
BrowserBreadcrumbWidget::BrowserBreadcrumbWidget( QWidget * parent ) : KHBox( parent) , m_rootList( 0 ) , m_childMenuButton( 0 ) { setFixedHeight( 28 ); setContentsMargins( 3, 0, 3, 0 ); setSpacing( 0 ); m_breadcrumbArea = new KHBox( this ); m_breadcrumbArea->setContentsMargins( 0, 0, 0, 0 ); m_breadcrumbArea->setSpacing( 0 ); setStretchFactor( m_breadcrumbArea, 10 ); new BreadcrumbUrlMenuButton( "navigate", this ); m_spacer = new QWidget( 0 ); }
int LinearLayoutAttached::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 3) qt_static_metacall(this, _c, _id, _a); _id -= 3; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< int*>(_v) = stretchFactor(); break; case 1: *reinterpret_cast< Qt::Alignment*>(_v) = alignment(); break; case 2: *reinterpret_cast< int*>(_v) = spacing(); break; } _id -= 3; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setStretchFactor(*reinterpret_cast< int*>(_v)); break; case 1: setAlignment(*reinterpret_cast< Qt::Alignment*>(_v)); break; case 2: setSpacing(*reinterpret_cast< int*>(_v)); break; } _id -= 3; } else if (_c == QMetaObject::ResetProperty) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 3; } #endif // QT_NO_PROPERTIES return _id; }
KviChannelListSelector::KviChannelListSelector(QWidget * par,const QString & txt,QStringList * pOption,bool bEnabled) : KviTalVBox(par), KviSelectorInterface() { m_pLabel = new QLabel(txt,this); m_pTreeWidget = new QTreeWidget(this); m_pTreeWidget->setRootIsDecorated(false); m_pTreeWidget->setColumnCount(2); QStringList columnLabels; columnLabels.append(__tr2qs("Channel Name")); columnLabels.append(__tr2qs("Channel Password")); m_pTreeWidget->setHeaderLabels(columnLabels); KviTalHBox* pEditsHBox = new KviTalHBox(this); m_pChanLineEdit = new QLineEdit(pEditsHBox); connect(m_pChanLineEdit,SIGNAL(textChanged(const QString &)),this,SLOT(textChanged(const QString &))); connect(m_pChanLineEdit,SIGNAL(returnPressed()),this,SLOT(addClicked())); m_pPassLineEdit = new QLineEdit(pEditsHBox); m_pPassLineEdit->setEchoMode(QLineEdit::Password); connect(m_pPassLineEdit,SIGNAL(textChanged(const QString &)),this,SLOT(textChanged(const QString &))); connect(m_pPassLineEdit,SIGNAL(returnPressed()),this,SLOT(addClicked())); KviTalHBox * hBox = new KviTalHBox(this); m_pAddButton = new QPushButton(__tr2qs("A&dd"),hBox); connect(m_pAddButton,SIGNAL(clicked()),this,SLOT(addClicked())); m_pRemoveButton = new QPushButton(__tr2qs("Re&move"),hBox); connect(m_pRemoveButton,SIGNAL(clicked()),this,SLOT(removeClicked())); m_pOption = pOption; for ( QStringList::Iterator it = pOption->begin(); it != pOption->end(); ++it ) { new KviChanTreeViewItem(m_pTreeWidget,(*it).section(':',0,0),(*it).section(':',1)); } m_pTreeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); m_pTreeWidget->setAllColumnsShowFocus(true); connect(m_pTreeWidget,SIGNAL(itemSelectionChanged()),this,SLOT(itemSelectionChanged())); setSpacing(4); setStretchFactor(m_pTreeWidget,1); setEnabled(bEnabled); }
KviStringListSelector::KviStringListSelector(QWidget * par,const QString & txt,QStringList * pOption,bool bEnabled) : KviTalVBox(par), KviSelectorInterface() { m_pLabel = new QLabel(txt,this); m_pListWidget = new KviTalListWidget(this); m_pLineEdit = new QLineEdit(this); connect(m_pLineEdit,SIGNAL(textChanged(const QString &)),this,SLOT(textChanged(const QString &))); connect(m_pLineEdit,SIGNAL(returnPressed()),this,SLOT(addClicked())); KviTalHBox * hBox = new KviTalHBox(this); m_pAddButton = new QPushButton(__tr2qs("A&dd"),hBox); connect(m_pAddButton,SIGNAL(clicked()),this,SLOT(addClicked())); m_pRemoveButton = new QPushButton(__tr2qs("Re&move"),hBox); connect(m_pRemoveButton,SIGNAL(clicked()),this,SLOT(removeClicked())); m_pOption = pOption; m_pListWidget->addItems(*pOption); m_pListWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); connect(m_pListWidget,SIGNAL(itemSelectionChanged()),this,SLOT(itemSelectionChanged())); setSpacing(4); setStretchFactor(m_pListWidget,1); setEnabled(bEnabled); }
KviPasswordSelector::KviPasswordSelector(QWidget * par,const QString & txt,QString *pOption,bool bEnabled) : KviTalHBox(par), KviSelectorInterface() { setSpacing(0); setMargin(0); m_pLabel = new QLabel(txt,this); m_pLineEdit = new QLineEdit(this); addSpacing(4); m_pCheckBox = new QCheckBox(this); m_pLineEdit->setEchoMode(QLineEdit::Password); m_pCheckBox->setCheckState(Qt::Checked); connect(m_pCheckBox,SIGNAL(stateChanged(int)), this, SLOT(checkToggled(int))); //m_pLineEdit->setMinimumWidth(200); QString tmp = *pOption; m_pLineEdit->setText(tmp); setStretchFactor(m_pLineEdit,1); m_pOption = pOption; setEnabled(bEnabled); }
//-------------------------------------------------------------------------- ScanView::ScanView(Scanner* scanner, QWidget* parent) : QSplitter(parent), scanner(scanner), library(new Library(this)), metaForm(new MetaDataForm(this)), imageViewer(new ImageViewer(this)) { // Connect signals for scan progress connect(scanner, SIGNAL(started()), this, SLOT(scanStarted())); connect(scanner, SIGNAL(finished(Scanner::ScanResult)), this, SLOT(scanFinished(Scanner::ScanResult))); createButtons(); QHBoxLayout* buttonsLayout = new QHBoxLayout; buttonsLayout->addWidget(scanPreviewButton); buttonsLayout->addWidget(cancelButton); buttonsLayout->addWidget(acceptScanButton); buttonsLayout->addWidget(rejectScanButton); buttonsLayout->addWidget(resetButton); // Connect signals for form states connect(metaForm, SIGNAL(isEmpty(bool)), this, SLOT(formIsEmpty(bool))); connect(metaForm, SIGNAL(isValid(bool)), scanPreviewButton, SLOT(setEnabled(bool))); QVBoxLayout* leftLayout = new QVBoxLayout; leftLayout->addWidget(metaForm); leftLayout->addLayout(buttonsLayout); QWidget* leftWidget = new QWidget(this); leftWidget->setLayout(leftLayout); addWidget(leftWidget); addWidget(imageViewer); setStretchFactor(1, 2); // Give more weight to the viewer }