OutputPanePlaceHolder::OutputPanePlaceHolder(Core::IMode *mode, QSplitter* parent) : QWidget(parent), d(new OutputPanePlaceHolderPrivate(mode, parent)) { setVisible(false); setLayout(new QVBoxLayout); QSizePolicy sp; sp.setHorizontalPolicy(QSizePolicy::Preferred); sp.setVerticalPolicy(QSizePolicy::Preferred); sp.setHorizontalStretch(0); setSizePolicy(sp); layout()->setMargin(0); connect(Core::ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)), this, SLOT(currentModeChanged(Core::IMode*))); // d->m_current = this; // Internal::OutputPaneManager *om = Internal::OutputPaneManager::instance(); // layout()->addWidget(om); // om->show(); // om->updateStatusButtons(isVisible()); }
void OpenconnectAuthWidget::viewServerLogToggled(bool toggled) { Q_D(OpenconnectAuthWidget); d->ui.lblLogLevel->setVisible(toggled); d->ui.cmbLogLevel->setVisible(toggled); if (toggled) { delete d->ui.verticalLayout->takeAt(5); QSizePolicy policy = d->ui.serverLogBox->sizePolicy(); policy.setVerticalPolicy(QSizePolicy::Expanding); d->ui.serverLogBox->setSizePolicy(policy); d->ui.serverLog->setVisible(true); } else { QSpacerItem *verticalSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); d->ui.verticalLayout->addItem(verticalSpacer); d->ui.serverLog->setVisible(false); QSizePolicy policy = d->ui.serverLogBox->sizePolicy(); policy.setVerticalPolicy(QSizePolicy::Fixed); d->ui.serverLogBox->setSizePolicy(policy); } }
ImageCanvas::ImageCanvas(DatabaseHandler * db, QWidget * parent) : QgsMapCanvas(parent), parent(parent), db(db) { // sizePolicy().setHeightForWidth(true); QSizePolicy policy; policy.setHorizontalPolicy(QSizePolicy::Expanding); policy.setVerticalPolicy(QSizePolicy::Preferred); policy.setHeightForWidth(true); setSizePolicy(policy); setBaseSize(240,240); enableAntiAliasing(true); setParallelRenderingEnabled( true ); setCanvasColor(QColor(0, 0, 0)); freeze(false); setCachingEnabled(true); setCacheMode(QgsMapCanvas::CacheBackground); setMapUnits(QGis::Meters); provider_registry = QgsProviderRegistry::instance(); layer_registry = QgsMapLayerRegistry::instance(); }
VideoWidget::VideoWidget(MainWindow *main) : QWidget((QWidget *)main) { qRegisterMetaType<VideoWidget::InputMode>("VideoWidget::InputMode"); m_main = main; m_xOffset=0; m_yOffset=0; m_scale = 1.0; m_drag = false; m_inputMode = NONE; m_selection = false; m_aspectRatio = VW_ASPECT_RATIO; // set size policy--- preferred aspect ratio QSizePolicy policy = sizePolicy(); policy.setHeightForWidth(true); setSizePolicy(policy); setMouseTracking(true); }
void AnimatedFrame::updateSizeHints() { if(widget_) { QSize hint = widget_->minimumSizeHint(); if(!hint.isValid()) hint = widget_->sizeHint(); QSizePolicy policy = widget_->sizePolicy(); if(edge_ == kNorth || edge_ == kSouth) { int minimum = widget_->minimumHeight(); int maximum = widget_->maximumHeight(); minimumSizeHint_.setWidth(0); minimumSizeHint_.setHeight(qBound(minimum, hint.height(), maximum)); setSizePolicy(policy.horizontalPolicy(), QSizePolicy::Maximum); } else { int minimum = widget_->minimumWidth(); int maximum = widget_->maximumWidth(); minimumSizeHint_.setWidth(qBound(minimum, hint.width(), maximum)); minimumSizeHint_.setHeight(0); setSizePolicy(QSizePolicy::Maximum, policy.verticalPolicy()); } setMinimumSize(widget_->minimumSize()); setMaximumSize(widget_->maximumSize()); } else { minimumSizeHint_ = QSize(); setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); } sizeHint_ = minimumSizeHint_; if(isUnfolded()) updateGeometry(); }
void BaseOrdinalMinMaxTextPropertyWidgetQt::generateWidget() { makeEditorWidgets(); QHBoxLayout* hLayout = new QHBoxLayout(); setSpacingAndMargins(hLayout); label_ = new EditableLabelQt(this, property_); hLayout->addWidget(label_); QHBoxLayout* textLayout = new QHBoxLayout(); QWidget* textWidget = new QWidget(); textWidget->setLayout(textLayout); textLayout->setContentsMargins(0,0,0,0); QSizePolicy sp = QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); sp.setHorizontalStretch(3); QLabel* minLabel = new QLabel("Min:"); textLayout->addWidget(minLabel); textLayout->addWidget(min_); min_->setSizePolicy(sp); QLabel* maxLabel = new QLabel("Max:"); textLayout->addWidget(maxLabel); textLayout->addWidget(max_); max_->setSizePolicy(sp); hLayout->addWidget(textWidget); setLayout(hLayout); QSizePolicy textsp = textWidget->sizePolicy(); textsp.setHorizontalStretch(3); textWidget->setSizePolicy(textsp); connect(min_, SIGNAL(valueChanged()), this, SLOT(updateFromMin())); connect(max_, SIGNAL(valueChanged()), this, SLOT(updateFromMax())); setFixedHeight(sizeHint().height()); sp = sizePolicy(); sp.setVerticalPolicy(QSizePolicy::Fixed); setSizePolicy(sp); }
void QSplitter::setOrientation(Qt::Orientation orientation) { Q_D(QSplitter); if (d->orient == orientation) return; if (!testAttribute(Qt::WA_WState_OwnSizePolicy)) { QSizePolicy sp = sizePolicy(); sp.transpose(); setSizePolicy(sp); setAttribute(Qt::WA_WState_OwnSizePolicy, false); } d->orient = orientation; for (int i = 0; i < d->list.size(); ++i) { QSplitterLayoutStruct *s = d->list.at(i); s->handle->setOrientation(orientation); } d->recalc(isVisible()); }
ChatWidget::ChatWidget(QWidget *parent) : QScrollArea(parent), ui(new Ui::ChatWidget) { ui->setupUi(this); this->setVerticalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOn); this->setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAsNeeded); QSizePolicy selfSizePolicy = this->sizePolicy(); selfSizePolicy.setHeightForWidth(true); this->setSizePolicy(selfSizePolicy); this->setWidgetResizable(true); QSizePolicy contentsSizePolicy = ui->scrollAreaWidgetContents->sizePolicy(); contentsSizePolicy.setHorizontalPolicy(QSizePolicy::Expanding); contentsSizePolicy.setVerticalPolicy(QSizePolicy::Expanding); contentsSizePolicy.setHeightForWidth(true); ui->scrollAreaWidgetContents->setSizePolicy(contentsSizePolicy); ui->scrollAreaWidgetContents->setMinimumWidth(400); this->setWidget(ui->scrollAreaWidgetContents); topLayout = new QVBoxLayout(); ui->scrollAreaWidgetContents->setLayout(topLayout); QPalette myPalette(palette()); myPalette.setColor(QPalette::Background, Qt::white); this->setAutoFillBackground(true); this->setPalette(myPalette); }
/*! \brief Set the thermometer orientation and the scale position. The scale position NoScale disables the scale. \param o orientation. Possible values are Qt::Horizontal and Qt::Vertical. The default value is Qt::Vertical. \param s Position of the scale. The default value is NoScale. A valid combination of scale position and orientation is enforced: - a horizontal thermometer can have the scale positions TopScale, BottomScale or NoScale; - a vertical thermometer can have the scale positions LeftScale, RightScale or NoScale; - an invalid scale position will default to NoScale. \sa setScalePosition() */ void QwtThermo::setOrientation( Qt::Orientation o, ScalePos s ) { if ( o == d_data->orientation && s == d_data->scalePos ) return; switch ( o ) { case Qt::Horizontal: { if ( ( s == NoScale ) || ( s == BottomScale ) || ( s == TopScale ) ) d_data->scalePos = s; else d_data->scalePos = NoScale; break; } case Qt::Vertical: { if ( ( s == NoScale ) || ( s == LeftScale ) || ( s == RightScale ) ) d_data->scalePos = s; else d_data->scalePos = NoScale; break; } } if ( o != d_data->orientation ) { if ( !testAttribute( Qt::WA_WState_OwnSizePolicy ) ) { QSizePolicy sp = sizePolicy(); sp.transpose(); setSizePolicy( sp ); setAttribute( Qt::WA_WState_OwnSizePolicy, false ); } } d_data->orientation = o; layoutThermo( true ); }
/*! \brief Set the orientation. \param orientation Allowed values are Qt::Horizontal and Qt::Vertical. \sa orientation(), scalePosition() */ void QwtSlider::setOrientation( Qt::Orientation orientation ) { if ( orientation == d_data->orientation ) return; d_data->orientation = orientation; scaleDraw()->setAlignment( qwtScaleDrawAlignment( orientation, d_data->scalePosition ) ); if ( !testAttribute( Qt::WA_WState_OwnSizePolicy ) ) { QSizePolicy sp = sizePolicy(); sp.transpose(); setSizePolicy( sp ); setAttribute( Qt::WA_WState_OwnSizePolicy, false ); } if ( testAttribute( Qt::WA_WState_Polished ) ) layoutSlider( true ); }
void OptionPropertyWidgetQt::generateWidget() { QHBoxLayout* hLayout = new QHBoxLayout(); hLayout->setContentsMargins(0, 0, 0, 0); hLayout->setSpacing(7); setLayout(hLayout); comboBox_ = new IvwComboBox(this); updateFromProperty(); comboBox_->setEnabled(!property_->getReadOnly()); comboBox_->setContextMenuPolicy(Qt::CustomContextMenu); connect(comboBox_, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showContextMenu(const QPoint&))); QSizePolicy slidersPol = comboBox_->sizePolicy(); slidersPol.setHorizontalStretch(3); comboBox_->setSizePolicy(slidersPol); label_ = new EditableLabelQt(this, property_); hLayout->addWidget(label_); { QWidget* widget = new QWidget(this); QSizePolicy sliderPol = widget->sizePolicy(); sliderPol.setHorizontalStretch(3); widget->setSizePolicy(sliderPol); QGridLayout* vLayout = new QGridLayout(); widget->setLayout(vLayout); vLayout->setContentsMargins(0, 0, 0, 0); vLayout->setSpacing(0); vLayout->addWidget(comboBox_); hLayout->addWidget(widget); } connect(comboBox_, SIGNAL(currentIndexChanged(int)),this, SLOT(optionChanged())); }
QOptionsDialogTab::QOptionsDialogTab(QWidget *parent) : QWidget(parent) { int space = 10; switch (ZLDeviceInfo::screenSize()) { case ZLDeviceInfo::SIZE_640x480: space = 10; break; default: space = 3; break; } myLayout = new QGridLayout(this, -1, 12, space, space); myRowCounter = 0; #if 0 QSizePolicy pol = this->sizePolicy(); pol.setHorData(QSizePolicy::Fixed); this->setSizePolicy(pol); QRect rect = QRect(0, 0, 240, 320); myLayout->setGeometry(rect); myLayout->setColStretch(12, 12); #endif }
WListItem::WListItem(const QString &city, const QString &state, const QString &id, QListWidget *citiesList) : m_id(id), m_name(city), m_state(state) { QString title = QString::fromLatin1("%1<br>%2") .arg(Qt::escape(city), Qt::escape(state)); m_label = new QLabel(title, this); QSizePolicy policy = m_label->sizePolicy(); policy.setHorizontalPolicy(QSizePolicy::MinimumExpanding); m_label->setSizePolicy(policy); m_button = new QPushButton(tr("Remove"), this); m_button->setIcon(qutim_sdk_0_3::Icon(QLatin1String("list-remove"))); connect(m_button, SIGNAL(clicked(bool)), this, SIGNAL(buttonClicked())); QHBoxLayout *layout = new QHBoxLayout(this); layout->addWidget(m_label); layout->addWidget(m_button); m_item = new QListWidgetItem(citiesList); m_item->setData(Qt::UserRole, qVariantFromValue(Guard(this))); m_item->setData(Qt::SizeHintRole, sizeHint()); citiesList->setItemWidget(m_item, this); }
Q_GUI_EXPORT QSize qSmartMaxSize(const QSize &sizeHint, const QSize &minSize, const QSize &maxSize, const QSizePolicy &sizePolicy, Qt::Alignment align) { if (align & Qt::AlignHorizontal_Mask && align & Qt::AlignVertical_Mask) return QSize(QLAYOUTSIZE_MAX, QLAYOUTSIZE_MAX); QSize s = maxSize; QSize hint = sizeHint.expandedTo(minSize); if (s.width() == QWIDGETSIZE_MAX && !(align & Qt::AlignHorizontal_Mask)) if (!(sizePolicy.horizontalPolicy() & QSizePolicy::GrowFlag)) s.setWidth(hint.width()); if (s.height() == QWIDGETSIZE_MAX && !(align & Qt::AlignVertical_Mask)) if (!(sizePolicy.verticalPolicy() & QSizePolicy::GrowFlag)) s.setHeight(hint.height()); if (align & Qt::AlignHorizontal_Mask) s.setWidth(QLAYOUTSIZE_MAX); if (align & Qt::AlignVertical_Mask) s.setHeight(QLAYOUTSIZE_MAX); return s; }
void Data_analysis_gui::init_controls_area() { QVBoxLayout * vbox = new QVBoxLayout(); controls_box_->setLayout(vbox); /* controls_box_->setOrientation( Qt::Vertical ); controls_box_->setColumns( 1 ); */ QRect controls_tabwidget_geom = controls_tabwidget_->geometry(); controls_tabwidget_geom.setWidth( 220 ); controls_tabwidget_->setGeometry( controls_tabwidget_geom ); QSizePolicy policy; policy.setHorizontalStretch(1); policy.setVerticalStretch(1); controls_tabwidget_->setSizePolicy(policy); //splitter_->setResizeMode( controls_tabwidget_, QSplitter::KeepSize ); // signal-slot connections for the axis preferences QObject::connect( minx_edit_, SIGNAL( returnPressed() ), this, SLOT( set_x_axis_min() ) ); QObject::connect( maxx_edit_, SIGNAL( returnPressed() ), this, SLOT( set_x_axis_max() ) ); QObject::connect( miny_edit_, SIGNAL( returnPressed() ), this, SLOT( set_y_axis_min() ) ); QObject::connect( maxy_edit_, SIGNAL( returnPressed() ), this, SLOT( set_y_axis_max() ) ); QObject::connect( reset_axis_x_button_, SIGNAL( clicked() ), this, SLOT( reset_x_axis() ) ); QObject::connect( reset_axis_y_button_, SIGNAL( clicked() ), this, SLOT( reset_y_axis() ) ); QObject::connect( x_logscale_checkbox_, SIGNAL( toggled( bool ) ), this, SLOT( set_x_axis_logscale( bool ) ) ); QObject::connect( y_logscale_checkbox_, SIGNAL( toggled( bool ) ), this, SLOT( set_y_axis_logscale( bool ) ) ); }
LuaEditorWidget::LuaEditorWidget() : m_outlineCombo(new QComboBox) { m_updateDocumentTimer.setInterval(UPDATE_DOCUMENT_DEFAULT_INTERVAL); m_updateDocumentTimer.setSingleShot(true); connect(&m_updateDocumentTimer, QTimer::timeout, this, LuaEditorWidget::updateDocument); connect(this, QPlainTextEdit::textChanged, [this](){m_updateDocumentTimer.start();}); m_outlineCombo->setMinimumContentsLength(22); QTreeView* treeView = new QTreeView; treeView->header()->hide(); treeView->setItemsExpandable(false); treeView->setRootIsDecorated(false); m_outlineCombo->setView(treeView); treeView->expandAll(); QSizePolicy policy = m_outlineCombo->sizePolicy(); policy.setHorizontalPolicy(QSizePolicy::Expanding); m_outlineCombo->setSizePolicy(policy); insertExtraToolBarWidget(TextEditorWidget::Left, m_outlineCombo); }
PlayerListArea::PlayerListArea(QWidget *parent) : QScrollArea(parent) { setContextMenuPolicy(Qt::DefaultContextMenu); setMaximumWidth(240); setMinimumWidth(220); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setAttribute(Qt::WA_TranslucentBackground, true); mainWidget = new QWidget; QSizePolicy policy; policy.setVerticalPolicy(QSizePolicy::Preferred); mainWidget->setSizePolicy(policy); //mainWidget->setMaximumWidth(this->viewport()->width()); setWidget(mainWidget); mainWidgetGLayout = new QGridLayout; mainWidget->setLayout(mainWidgetGLayout); mainWidgetGLayout->setAlignment(Qt::AlignLeft|Qt::AlignTop); // mainWidgetGLayout->setMargin(0); // mainWidgetGLayout->setSpacing(0); //QTimer::singleShot(1000, this, SLOT(updateList())); this->setWidgetResizable(true); updateList(); }
osg::GraphicsContext::Traits* GraphicsWindowQt::createTraits( const QGLWidget* widget ) { osg::GraphicsContext::Traits *traits = new osg::GraphicsContext::Traits; qglFormat2traits( widget->format(), traits ); QRect r = widget->geometry(); traits->x = r.x(); traits->y = r.y(); traits->width = r.width(); traits->height = r.height(); traits->windowName = widget->windowTitle().toLocal8Bit().data(); Qt::WindowFlags f = widget->windowFlags(); traits->windowDecoration = ( f & Qt::WindowTitleHint ) && ( f & Qt::WindowMinMaxButtonsHint ) && ( f & Qt::WindowSystemMenuHint ); QSizePolicy sp = widget->sizePolicy(); traits->supportsResize = sp.horizontalPolicy() != QSizePolicy::Fixed || sp.verticalPolicy() != QSizePolicy::Fixed; return traits; }
void GLSLTextEditorWidget::createToolBar(GLSLEditorEditable *editor) { m_outlineCombo = new QComboBox; m_outlineCombo->setMinimumContentsLength(22); // ### m_outlineCombo->setModel(m_outlineModel); QTreeView *treeView = new QTreeView; treeView->header()->hide(); treeView->setItemsExpandable(false); treeView->setRootIsDecorated(false); m_outlineCombo->setView(treeView); treeView->expandAll(); //m_outlineCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents); // Make the combo box prefer to expand QSizePolicy policy = m_outlineCombo->sizePolicy(); policy.setHorizontalPolicy(QSizePolicy::Expanding); m_outlineCombo->setSizePolicy(policy); editor->insertExtraToolBarWidget(TextEditor::BaseTextEditor::Left, m_outlineCombo); }
RazorMainMenu::RazorMainMenu(const RazorPanelPluginStartInfo* startInfo, QWidget* parent): RazorPanelPlugin(startInfo, parent), mMenu(0) { setObjectName("MainMenu"); addWidget(&mButton); connect(&mButton, SIGNAL(clicked()), this, SLOT(showMenu())); mPowerManager = new PowerManager(this); mPowerManager->setParentWidget(panel()); mScreenSaver = new ScreenSaver(this); mShortcut = new QxtGlobalShortcut(this); connect(mShortcut, SIGNAL(activated()), this, SLOT(showMenu())); settigsChanged(); QSizePolicy sp = mButton.sizePolicy(); sp.setVerticalPolicy(QSizePolicy::Minimum); mButton.setSizePolicy(sp); }
ServicesList :: ServicesList (QWidget *parent_p) : QListWidget (parent_p) { sl_stacked_widgets_p = new QStackedWidget (this); sl_services_p = new QListWidget (this); connect (sl_services_p, &QAbstractItemView :: clicked, this, &ServicesList :: SetCurrentService); connect (sl_services_p, &QAbstractItemView :: doubleClicked, this, &ServicesList :: ToggleServiceRunStatus); connect (sl_services_p, &QListWidget :: itemChanged, this, &ServicesList :: CheckServiceRunStatus); QGroupBox *box_p = new QGroupBox (tr ("Services")); box_p -> setAlignment (Qt :: AlignRight); QHBoxLayout *services_layout_p = new QHBoxLayout; services_layout_p -> addWidget (sl_services_p); box_p -> setLayout (services_layout_p); QHBoxLayout *layout_p = new QHBoxLayout; /* layout_p -> addWidget (box_p); layout_p -> addWidget (sl_stacked_widgets_p); */ QSplitter *splitter_p = new QSplitter (this); splitter_p -> setHandleWidth (2); splitter_p -> addWidget (box_p); splitter_p -> addWidget (sl_stacked_widgets_p); layout_p -> addWidget (splitter_p); setLayout (layout_p); QSizePolicy p; p.setHorizontalPolicy (QSizePolicy :: MinimumExpanding); sl_services_p -> setSizePolicy (p); }
static QString sizePolicyToString(const QSizePolicy &p) { QString rc; { QTextStream str(&rc); str << "Control=" << p.controlType() << " expdirs=" << p.expandingDirections() << " hasHeightForWidth=" << p.hasHeightForWidth() << " H: Policy=" << p.horizontalPolicy() << " stretch=" << p.horizontalStretch() << " V: Policy=" << p.verticalPolicy() << " stretch=" << p.verticalStretch(); } return rc; }
StereogramWidget::StereogramWidget(QWidget *parent) : QLabel("",parent) , m_angularStep_deg(0) , m_densityGrid(0) , m_meanDipDir_deg(-1.0) , m_meanDip_deg(-1.0) , m_densityColorScale(0) , m_densityColorScaleSteps(ccColorScale::MAX_STEPS < 256 ? ccColorScale::MAX_STEPS : 256) //DGM: we can't pass a constant initializer (MAX_STEPS) by reference , m_ticksFreq(3) , m_showHSVRing(false) , m_trackMouseClick(false) , m_clickDip_deg(0.0) , m_clickDipDir_deg(0.0) , m_clickDipSpan_deg(30.0) , m_clickDipDirSpan_deg(30.0) , m_center(0,0) , m_radius(0) { setVisible(true); QSizePolicy policy = sizePolicy(); policy.setHeightForWidth(true); setSizePolicy(policy); //setFixedSize(256,256); }
/*! \brief Set the orientation. \param o Orientation. Allowed values are Qt::Horizontal and Qt::Vertical. If the new orientation and the old scale position are an invalid combination, the scale position will be set to QwtSlider::NoScale. \sa QwtAbstractSlider::orientation() */ void QwtSlider::setOrientation(Qt::Orientation o) { if ( o == orientation() ) return; if (o == Qt::Horizontal) { if ((d_data->scalePos == LeftScale) || (d_data->scalePos == RightScale)) d_data->scalePos = NoScale; } else // if (o == Qt::Vertical) { if ((d_data->scalePos == BottomScale) || (d_data->scalePos == TopScale)) d_data->scalePos = NoScale; } #if QT_VERSION >= 0x040000 if ( !testAttribute(Qt::WA_WState_OwnSizePolicy) ) #else if ( !testWState( WState_OwnSizePolicy ) ) #endif { QSizePolicy sp = sizePolicy(); sp.transpose(); setSizePolicy(sp); #if QT_VERSION >= 0x040000 setAttribute(Qt::WA_WState_OwnSizePolicy, false); #else clearWState( WState_OwnSizePolicy ); #endif } QwtAbstractSlider::setOrientation(o); layoutSlider(); }
StereogramWidget::StereogramWidget(QWidget *parent) : QLabel("",parent) , m_angularStep_deg(0) , m_densityGrid(0) , m_meanDipDir_deg(-1.0) , m_meanDip_deg(-1.0) , m_densityColorScale(0) , m_densityColorScaleSteps(std::min<unsigned>(256,ccColorScale::MAX_STEPS)) , m_ticksFreq(3) , m_showHSVRing(false) , m_trackMouseClick(false) , m_clickDip_deg(0.0) , m_clickDipDir_deg(0.0) , m_clickDipSpan_deg(30.0) , m_clickDipDirSpan_deg(30.0) , m_center(0,0) , m_radius(0) { setVisible(true); QSizePolicy policy = sizePolicy(); policy.setHeightForWidth(true); setSizePolicy(policy); //setFixedSize(256,256); }
/** * @brief constructor */ RazorClock::RazorClock(const RazorPanelPluginStartInfo* startInfo, QWidget* parent): RazorPanelPlugin(startInfo, parent), calendarDialog(0) { setObjectName("Clock"); clockFormat = "hh:mm"; gui = new ClockLabel(this); gui->setAlignment(Qt::AlignCenter); this->layout()->setAlignment(Qt::AlignCenter); QSizePolicy sizePolicy = QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); gui->setSizePolicy(sizePolicy); this->setSizePolicy(sizePolicy); addWidget(gui); connect(gui, SIGNAL(fontChanged()), this, SLOT(updateMinWidth())); settigsChanged(); clocktimer = new QTimer(this); connect (clocktimer, SIGNAL(timeout()), this, SLOT(updateTime())); clocktimer->start(1000); }
/* SearchLineEdit is an enhanced QLineEdit - A Search icon on the left with optional menu - When there is no text and doesn't have focus an "inactive text" is displayed - When there is text a clear button is displayed on the right hand side */ SearchLineEdit::SearchLineEdit(QWidget *parent) : LineEdit(parent) , m_searchButton(0) { setUpdatesEnabled(false); m_searchButton = new SearchButton(this); updateGeometries(); addWidget(m_searchButton, LeftSide); m_inactiveText = tr("Search"); QSizePolicy policy = sizePolicy(); setSizePolicy(QSizePolicy::Preferred, policy.verticalPolicy()); // clear button on the right ClearButton *m_clearButton = new ClearButton(this); connect(m_clearButton, SIGNAL(clicked()), this, SLOT(clear())); connect(this, SIGNAL(textChanged(const QString&)), m_clearButton, SLOT(textChanged(const QString&))); addWidget(m_clearButton, RightSide); m_clearButton->hide(); updateTextMargins(); setUpdatesEnabled(true); }
WBTabWidget::WBTabWidget(QWidget *parent) : QTabWidget(parent) , mRecentlyClosedTabsMenu(0) , mLineEditCompleter(0) , mLineEdits(0) , mTabBar(new WBTabBar(this)) { setObjectName("ubWebBrowserTabWidget"); mAddTabIcon = QPixmap(":/images/toolbar/plusBlack.png"); setElideMode(Qt::ElideRight); connect(mTabBar, SIGNAL(newTab()), this, SLOT(newTab())); connect(mTabBar, SIGNAL(closeTab(int)), this, SLOT(closeTab(int))); connect(mTabBar, SIGNAL(cloneTab(int)), this, SLOT(cloneTab(int))); connect(mTabBar, SIGNAL(closeOtherTabs(int)), this, SLOT(closeOtherTabs(int))); connect(mTabBar, SIGNAL(reloadTab(int)), this, SLOT(reloadTab(int))); connect(mTabBar, SIGNAL(reloadAllTabs()), this, SLOT(reloadAllTabs())); connect(mTabBar, SIGNAL(tabMoved(int, int)), this, SLOT(moveTab(int, int))); setTabBar(mTabBar); setDocumentMode(false); mRecentlyClosedTabsMenu = new QMenu(this); connect(mRecentlyClosedTabsMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowRecentTabsMenu())); connect(mRecentlyClosedTabsMenu, SIGNAL(triggered(QAction *)), this, SLOT(aboutToShowRecentTriggeredAction(QAction *))); mRecentlyClosedTabsAction = new QAction(tr("Recently Closed Tabs"), this); mRecentlyClosedTabsAction->setMenu(mRecentlyClosedTabsMenu); mRecentlyClosedTabsAction->setEnabled(false); connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int))); mLineEdits = new QStackedWidget(this); mLineEdits->setMinimumWidth(200); QSizePolicy spolicy = mLineEdits->sizePolicy(); mLineEdits->setSizePolicy(QSizePolicy::Maximum, spolicy.verticalPolicy()); }
void ComboOptionView::_createItem() { myLabel = new QLabel(myOption->name().c_str(), myTab); myComboBox = new ZComboBox(myTab, "ZComboBox", true); const std::vector<std::string> &values = ((ZLComboOptionEntry*)myOption)->values(); const std::string &initial = ((ZLComboOptionEntry*)myOption)->initialValue(); int selectedIndex = -1; int index = 0; for (std::vector<std::string>::const_iterator it = values.begin(); it != values.end(); ++it, ++index) { myComboBox->insertItem(QString(it->c_str()), index); if (*it == initial) { selectedIndex = index; } } QFont f = qApp->font(); f.setPointSize(14); myLabel->setFont(f); #if 0 QRect rect = myComboBox->getContentRect(); rect.setWidth(80); myComboBox->setGeometry(rect); QSizePolicy pol = myComboBox->sizePolicy(); pol.setHorData(QSizePolicy::Fixed); myComboBox->setSizePolicy(pol); pol = myLabel->sizePolicy(); pol.setHorData(QSizePolicy::Fixed); myLabel->setSizePolicy(pol); myLabel->setLineWidth(80); #endif connect(myComboBox, SIGNAL(activated(int)), this, SLOT(onValueChange(int))); if (selectedIndex >= 0) { myComboBox->setCurrentItem(selectedIndex); } int width = myToColumn - myFromColumn + 1; myTab->addItem(myLabel, myRow, myFromColumn, myFromColumn + width * 2 /3 - 1, Qt::AlignLeft); myTab->addItem(myComboBox, myRow, myToColumn - width * 2 / 3, myToColumn, Qt::AlignRight); }
QWidget* QCamAutoAlign::buildGUI(QWidget * parent) { QSizePolicy sizePolicyMax; sizePolicyMax.setVerticalPolicy(QSizePolicy::Expanding); sizePolicyMax.setHorizontalPolicy(QSizePolicy::Expanding); QSizePolicy sizePolicyMin; sizePolicyMin.setVerticalPolicy(QSizePolicy::Minimum); sizePolicyMin.setHorizontalPolicy(QSizePolicy::Minimum); QWidget* remoteCTRL= QCam::buildGUI(parent); QCamUtilities::registerWidget(remoteCTRL); QPushButton* resetCenter = new QPushButton(tr("reset"),remoteCTRL); connect(resetCenter,SIGNAL(pressed()),this,SLOT(reset())); findShiftWidget_=new QCamHGroupBox(tr("Find Shift Ctrl"),remoteCTRL); if (tracker_) { findShiftCtrl_=tracker_->buildGUI(findShiftWidget_); } cropSlider_=new QCamSlider(tr("crop"),false,remoteCTRL,1,100); cropSlider_->setSizePolicy(sizePolicyMin); connect(cropSlider_, SIGNAL(valueChange(int)), this,SLOT(setCropValue(int))); cropSlider_->setValue((int)round(cropValue_*100)); cropSlider_->setToolTip(tr("% of image to keep when crooping")); centerButton_=new QCheckBox(tr("Center image"),remoteCTRL); connect(centerButton_,SIGNAL(toggled(bool)),this,SLOT(setImageCenter(bool))); centerButton_->setToolTip(tr("Center shifted images on the center of the frame")); #if ONE_MAP scaleSlider_=new QCamSlider(tr("Display scale"),false,remoteCTRL,1,100); scaleSlider_->setSizePolicy(sizePolicyMin); scaleSlider_->setToolTip(tr("Scale of the shift history Map")); shiftMap_= new QVectorMap(remoteCTRL); shiftMap_->setSizePolicy(sizePolicyMax); shiftMap_->setMode(DrawLine); connect(scaleSlider_, SIGNAL(valueChange(int)),shiftMap_,SLOT(setScale(int))); shiftMap_->setToolTip(tr("Show the history of the frame shift")); #else shiftXhisto_ = new QHistogram(remoteCTRL); shiftXhisto_->setDataSize(200); shiftXhisto_->setAutoShift(true); shiftXhisto_->setAverage(4); shiftYhisto_ = new QHistogram(remoteCTRL); shiftYhisto_->setDataSize(200); shiftYhisto_->setAutoShift(true); shiftYhisto_->setAverage(4); #endif resetCenter->show(); return remoteCTRL; }