当前位置: 首页>>代码示例>>C++>>正文


C++ QBoxLayout类代码示例

本文整理汇总了C++中QBoxLayout的典型用法代码示例。如果您正苦于以下问题:C++ QBoxLayout类的具体用法?C++ QBoxLayout怎么用?C++ QBoxLayout使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QBoxLayout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QWidget

PerformanceMeasurement::Panel::Panel(QWidget *parent)
  : QWidget(parent, 0, Qt::WStyle_NormalBorder | Qt::WDestructiveClose),
    Workspace::Instance( "Performance Measuremnt", vars, num_vars ), state( INIT1),
    duration( 0 ), lastRead( 0 ), timestep( 0 ), maxDuration( 0 ), maxTimestep( 0 ), jitter( 0 )
{
  QHBox *hbox;
  QBoxLayout *layout = new QVBoxLayout(this);

  setCaption("Real-time Benchmarks");

  hbox = new QHBox(this);
  layout->addWidget(hbox);
  QChar mu = QChar(0x3BC);
  QString suffix = QString("s)");

  QString labeltext = "Computation Time (";
  labeltext.append(mu);
  labeltext.append(suffix);
  (void) (new QLabel(labeltext, hbox))->setFixedWidth(175);
  durationEdit = new QLineEdit(hbox);

  hbox = new QHBox(this);
  layout->addWidget(hbox);
  labeltext = "Peak Computation Time (";
  labeltext.append(mu);
  labeltext.append(suffix);
  (void) (new QLabel(labeltext, hbox))->setFixedWidth(175);
  maxDurationEdit = new QLineEdit(hbox);

  hbox = new QHBox(this);
  layout->addWidget(hbox);
  labeltext = "Real-time Period (";
  labeltext.append(mu);
  labeltext.append(suffix);
  (void) (new QLabel(labeltext, hbox))->setFixedWidth(175);
  timestepEdit = new QLineEdit(hbox);

  hbox = new QHBox(this);
  layout->addWidget(hbox);
  labeltext = "Peak Real-time Period (";
  labeltext.append(mu);
  labeltext.append(suffix);
  (void) (new QLabel(labeltext, hbox))->setFixedWidth(175);
  maxTimestepEdit = new QLineEdit(hbox);
  QToolTip::add(maxTimestepEdit, "The worst case time step");

  hbox = new QHBox(this);
  layout->addWidget(hbox);
  labeltext = "Real-time Jitter (";
  labeltext.append(mu);
  labeltext.append(suffix);
  (void) (new QLabel(labeltext, hbox))->setFixedWidth(175);
  timestepJitterEdit = new QLineEdit(hbox);
  QToolTip::add(timestepJitterEdit, "The variance in the real-time period");

  hbox = new QHBox(this);
  layout->addWidget(hbox);
  QPushButton *resetButton = new QPushButton("Reset", this);
  layout->addWidget(resetButton);
  QObject::connect(resetButton,SIGNAL(clicked(void)),this,SLOT(reset(void)));

  QTimer *timer = new QTimer(this);
  timer->start(500);
  QObject::connect(timer,SIGNAL(timeout(void)),this,SLOT(update(void)));

  // Connect states to workspace
  setData( Workspace::STATE, 0, &duration );
  setData( Workspace::STATE, 1, &maxDuration );
  setData( Workspace::STATE, 2, &timestep );
  setData( Workspace::STATE, 3, &maxTimestep );
  setData( Workspace::STATE, 4, &jitter );

  setActive(true);
  saveStats = false;
}
开发者ID:jbetten,项目名称:rtxi,代码行数:75,代码来源:performance_measurement.cpp

示例2: QDialog

NotificationDialog::NotificationDialog(Notification *notification, QWidget *parent) : QDialog(parent),
	m_notification(notification),
	m_closeLabel(NULL)
{
	QFrame *notificationFrame = new QFrame(this);
	notificationFrame->setObjectName(QLatin1String("notificationFrame"));
	notificationFrame->setStyleSheet(QLatin1String("#notificationFrame {padding:5px;border:1px solid #CCC;border-radius:10px;background:#F0F0f0;}"));
	notificationFrame->setCursor(QCursor(Qt::PointingHandCursor));
	notificationFrame->installEventFilter(this);

	QBoxLayout *mainLayout = new QBoxLayout(QBoxLayout::LeftToRight);
	mainLayout->setContentsMargins(0, 0, 0, 0);
	mainLayout->setSpacing(0);
	mainLayout->setSizeConstraint(QLayout::SetMinimumSize);
	mainLayout->addWidget(notificationFrame);

	QLabel *iconLabel = new QLabel(this);
	iconLabel->setPixmap(Utils::getIcon(QLatin1String("otter-browser-32")).pixmap(32, 32));
	iconLabel->setStyleSheet(QLatin1String("padding:5px;"));

	QLabel *messageLabel = new QLabel(this);
	messageLabel->setText(m_notification->getMessage());
	messageLabel->setStyleSheet(QLatin1String("padding:5px;font-size:13px;"));
	messageLabel->setWordWrap(true);

	QStyleOption option;
	option.rect = QRect(0, 0, 16, 16);

	QPixmap pixmap(16, 16);
	pixmap.fill(Qt::transparent);

	QPainter painter(&pixmap);

	style()->drawPrimitive(QStyle::PE_IndicatorTabClose, &option, &painter, this);

	m_closeLabel = new QLabel(notificationFrame);
	m_closeLabel->setToolTip(tr("Close"));
	m_closeLabel->setPixmap(pixmap);
	m_closeLabel->setAlignment(Qt::AlignTop);
	m_closeLabel->setMargin(5);
	m_closeLabel->installEventFilter(this);

	QBoxLayout *notificationLayout = new QBoxLayout(QBoxLayout::LeftToRight);
	notificationLayout->setContentsMargins(0, 0, 0, 0);
	notificationLayout->setSpacing(0);
	notificationLayout->setSizeConstraint(QLayout::SetMinimumSize);
	notificationLayout->addWidget(iconLabel);
	notificationLayout->addWidget(messageLabel);
	notificationLayout->addWidget(m_closeLabel);

	notificationFrame->setLayout(notificationLayout);

	setLayout(mainLayout);
	setFixedWidth(400);
	setMinimumHeight(50);
	setMaximumHeight(150);
	setWindowOpacity(0);
	setWindowFlags(Qt::WindowStaysOnTopHint | Qt::Tool | Qt::FramelessWindowHint);
	setFocusPolicy(Qt::NoFocus);
	setAttribute(Qt::WA_ShowWithoutActivating);
	setAttribute(Qt::WA_TranslucentBackground);
	adjustSize();

	m_animation = new QPropertyAnimation(this, QStringLiteral("windowOpacity").toLatin1());
	m_animation->setDuration(500);
	m_animation->setStartValue(0.0);
	m_animation->setEndValue(1.0);
	m_animation->start();

	const int visibilityDuration = SettingsManager::getValue(QLatin1String("Interface/NotificationVisibilityDuration")).toInt();

	if (visibilityDuration > 0)
	{
		QTimer::singleShot((visibilityDuration * 1000), this, SLOT(aboutToClose()));
	}
}
开发者ID:testmana2,项目名称:otter-browser,代码行数:76,代码来源:NotificationDialog.cpp

示例3: QHBoxLayout

/*!
  Changes the status bar's appearance to account for item
  changes. Special subclasses may need this, but normally
  geometry management will take care of any necessary
  rearrangements.
*/
void QStatusBar::reformat()
{
    if ( d->box )
	delete d->box;

    QBoxLayout *vbox;
    if ( isSizeGripEnabled() ) {
	d->box = new QHBoxLayout( this );
	vbox = new QVBoxLayout( d->box );
    } else {
	vbox = d->box = new QVBoxLayout( this );
    }
    vbox->addSpacing( 3 );
    QBoxLayout* l = new QHBoxLayout( vbox );
    l->addSpacing( 3 );

    int maxH = fontMetrics().height();

    QStatusBarPrivate::SBItem* item = d->items.first();
    while ( item && !item->p ) {
	l->addWidget( item->w, item->s );
	l->addSpacing( 4 );
	int itemH = item->w->sizeHint().height();
	maxH = QMAX( maxH, itemH );
	item = d->items.next();
    }

    l->addStretch( 0 );

    while ( item ) {
	l->addWidget( item->w, item->s );
	l->addSpacing( 4 );
	int itemH = item->w->sizeHint().height();
	maxH = QMAX( maxH, itemH );
	item = d->items.next();
    }
#ifndef QT_NO_SIZEGRIP
    if ( d->resizer ) {
	maxH = QMAX( maxH, d->resizer->sizeHint().height() );
	d->box->addSpacing( 2 );
	d->box->addWidget( d->resizer, 0, AlignBottom );
    }
#endif
    l->addStrut( maxH );
    vbox->addSpacing( 2 );
    d->box->activate();
    repaint();
}
开发者ID:opieproject,项目名称:qte-opie,代码行数:54,代码来源:qstatusbar.cpp

示例4: KDialog

DvbEpgDialog::DvbEpgDialog(DvbManager *manager_, QWidget *parent) : KDialog(parent),
	manager(manager_)
{
	setButtons(KDialog::Close);
	setCaption(i18nc("@title:window", "Program Guide"));

	QWidget *widget = new QWidget(this);
	QBoxLayout *mainLayout = new QHBoxLayout(widget);

	epgChannelTableModel = new DvbEpgChannelTableModel(this);
	epgChannelTableModel->setManager(manager);
	channelView = new QTreeView(widget);
	channelView->setMaximumWidth(30 * fontMetrics().averageCharWidth());
	channelView->setModel(epgChannelTableModel);
	channelView->setRootIsDecorated(false);
	channelView->setUniformRowHeights(true);
	connect(channelView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
		this, SLOT(channelActivated(QModelIndex)));
	mainLayout->addWidget(channelView);

	QBoxLayout *rightLayout = new QVBoxLayout();
	QBoxLayout *boxLayout = new QHBoxLayout();

	KAction *scheduleAction = new KAction(QIcon::fromTheme(QLatin1String("media-record")),
		i18nc("@action:inmenu tv show", "Record Show"), this);
	connect(scheduleAction, SIGNAL(triggered()), this, SLOT(scheduleProgram()));

	QPushButton *pushButton =
		new QPushButton(scheduleAction->icon(), scheduleAction->text(), widget);
	connect(pushButton, SIGNAL(clicked()), this, SLOT(scheduleProgram()));
	boxLayout->addWidget(pushButton);

	boxLayout->addWidget(new QLabel(i18nc("@label:textbox", "Search:"), widget));

	epgTableModel = new DvbEpgTableModel(this);
	epgTableModel->setEpgModel(manager->getEpgModel());
	connect(epgTableModel, SIGNAL(layoutChanged()), this, SLOT(checkEntry()));
	KLineEdit *lineEdit = new KLineEdit(widget);
	lineEdit->setClearButtonShown(true);
	connect(lineEdit, SIGNAL(textChanged(QString)),
		epgTableModel, SLOT(setContentFilter(QString)));
	boxLayout->addWidget(lineEdit);
	rightLayout->addLayout(boxLayout);

	epgView = new QTreeView(widget);
	epgView->addAction(scheduleAction);
	epgView->header()->setResizeMode(QHeaderView::ResizeToContents);
	epgView->setContextMenuPolicy(Qt::ActionsContextMenu);
	epgView->setMinimumWidth(75 * fontMetrics().averageCharWidth());
	epgView->setModel(epgTableModel);
	epgView->setRootIsDecorated(false);
	epgView->setUniformRowHeights(true);
	connect(epgView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
		this, SLOT(entryActivated(QModelIndex)));
	rightLayout->addWidget(epgView);

	contentLabel = new QLabel(widget);
	contentLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop);
	contentLabel->setMargin(5);
	contentLabel->setWordWrap(true);

	QScrollArea *scrollArea = new QScrollArea(widget);
	scrollArea->setBackgroundRole(QPalette::Light);
	scrollArea->setMinimumHeight(12 * fontMetrics().height());
	scrollArea->setWidget(contentLabel);
	scrollArea->setWidgetResizable(true);
	rightLayout->addWidget(scrollArea);
	mainLayout->addLayout(rightLayout);
	setMainWidget(widget);
}
开发者ID:hiroshiyui,项目名称:kaffeine,代码行数:70,代码来源:dvbepgdialog.cpp

示例5: QBoxLayout

Configurator::Configurator(QWidget *parent) :QWidget(parent)
{
    #ifdef K_DEBUG
           TINIT;
    #endif

    QBoxLayout *mainLayout = new QBoxLayout(QBoxLayout::TopToBottom, this);

    /*
    QTextEdit *textArea = new QTextEdit; 
    textArea->setFixedHeight(170);
    textArea->setHtml("<p>" + tr("This tool is just a <b>proof-of-concept</b> of the basic algorithm for the Tupi's free-tracing vectorial brushes") + "</p>"); 
    mainLayout->addWidget(textArea);
    */

    QBoxLayout *layout = new QBoxLayout(QBoxLayout::TopToBottom);
    QLabel *label = new QLabel(tr("Parameters"));
    label->setAlignment(Qt::AlignHCenter);
    layout->addWidget(label);
    mainLayout->addLayout(layout);

    /*
    QBoxLayout *structureLayout = new QBoxLayout(QBoxLayout::TopToBottom);
    QLabel *structureLabel = new QLabel(tr("Structure"));
    structureLabel->setAlignment(Qt::AlignHCenter);
    structureLayout->addWidget(structureLabel);

    structureCombo = new QComboBox();
    structureCombo->addItem(tr("Basic"));
    structureCombo->addItem(tr("Axial"));
    structureCombo->addItem(tr("Organic"));
    structureCombo->setCurrentIndex(2);
    structureLayout->addWidget(structureCombo);

    mainLayout->addLayout(structureLayout);
    */

    QBoxLayout *spaceLayout = new QBoxLayout(QBoxLayout::TopToBottom);
    QLabel *spaceLabel = new QLabel(tr("Dot Spacing"));
    spaceLabel->setAlignment(Qt::AlignHCenter);
    spaceLayout->addWidget(spaceLabel);

    spacingBox = new QSpinBox();
    spacingBox->setSingleStep(1);
    spacingBox->setMinimum(1);
    spacingBox->setMaximum(10);
    spacingBox->setValue(5);
    spaceLayout->addWidget(spacingBox);

    connect(spacingBox, SIGNAL(valueChanged(int)), this, SIGNAL(updateSpacing(int)));

    mainLayout->addLayout(spaceLayout);

    QBoxLayout *sizeLayout = new QBoxLayout(QBoxLayout::TopToBottom);
    QLabel *sizeLabel = new QLabel(tr("Size Tolerance"));
    sizeLabel->setAlignment(Qt::AlignHCenter);
    sizeLayout->addWidget(sizeLabel);

    sizeBox = new QSpinBox();
    sizeBox->setSingleStep(10);
    sizeBox->setMinimum(0);
    sizeBox->setMaximum(200);
    sizeBox->setValue(50);
    sizeLayout->addWidget(sizeBox);

    connect(sizeBox, SIGNAL(valueChanged(int)), this, SIGNAL(updateSizeTolerance(int)));

    mainLayout->addLayout(sizeLayout);

    /*
    QBoxLayout *checkLayout = new QBoxLayout(QBoxLayout::TopToBottom);
    checkBox = new QCheckBox(tr("Run simulation"));
    checkBox->setChecked(true);
    checkLayout->addWidget(checkBox);
    connect(checkBox, SIGNAL(stateChanged(int)), this, SLOT(updateInterface(int)));
    mainLayout->addLayout(checkLayout);
    */

    QBoxLayout *smoothLayout = new QBoxLayout(QBoxLayout::TopToBottom);
    QLabel *smoothLabel = new QLabel(tr("Smoothness"));
    smoothLabel->setAlignment(Qt::AlignHCenter);
    smoothLayout->addWidget(smoothLabel);
    smoothBox = new QDoubleSpinBox();

    smoothBox->setValue(4.0);
    smoothBox->setDecimals(2);
    smoothBox->setSingleStep(0.1);
    smoothBox->setMaximum(100);
    smoothLayout->addWidget(smoothBox);

    mainLayout->addLayout(smoothLayout);
    // smoothBox->setDisabled(true);

    mainLayout->addStretch(2);
}
开发者ID:hpsaturn,项目名称:tupi,代码行数:95,代码来源:configurator.cpp

示例6: tr

void ControllBarUI::setupButtonIcons() {
    QBoxLayout *layout = qobject_cast<QBoxLayout*>( _ui->_buttonContainer->layout() );

    if( layout == NULL ) {
        Error error;
        error.setErrorMessage( tr( "Cannot display controll bar buttons because buttonContainer layout cannot be cast to QBoxLayout" ), Error::Fatal );
        Error::raise( &error );
        return;
    }

    QBoxLayout *layoutMuteButtons = qobject_cast<QBoxLayout*>( _ui->_muteButtonRegion->layout() );

    if( layoutMuteButtons == NULL ) {
        Error error;
        error.setErrorMessage( tr( "Cannot display mute buttons because mute buttonsRegin layout cannot be cast to QBoxLayout" ), Error::Fatal );
        Error::raise( &error );
        return;
    }

    _backwardButton = new ToogleButton( _ui->_buttonContainer,
                                        Constants::CONTROLL_BAR_IMAGE_DIR + Constants::CONTROLL_BAR_BACKWARD,
                                        Constants::CONTROLL_BAR_IMAGE_DIR + "active" + Constants::CONTROLL_BAR_BACKWARD );
    _backwardButton->setDisabledImage( Constants::CONTROLL_BAR_IMAGE_DIR + "disabled" + Constants::CONTROLL_BAR_BACKWARD );
    layout->insertWidget( 0, _backwardButton );

    _playButton = new CommandButton( _ui->_buttonContainer,
                                     Constants::CONTROLL_BAR_IMAGE_DIR + Constants::CONTROLL_BAR_PLAY );
    _playButton->setMouseOverImage( Constants::CONTROLL_BAR_IMAGE_DIR + "active" + Constants::CONTROLL_BAR_PLAY );
    _playButton->setDisabledImage( Constants::CONTROLL_BAR_IMAGE_DIR + "disabled" + Constants::CONTROLL_BAR_PLAY );
    layout->insertWidget( 1, _playButton );

    _forwardButton = new ToogleButton( _ui->_buttonContainer,
                                       Constants::CONTROLL_BAR_IMAGE_DIR + Constants::CONTROLL_BAR_FORWARD,
                                       Constants::CONTROLL_BAR_IMAGE_DIR + "active" + Constants::CONTROLL_BAR_FORWARD );
    _forwardButton->setDisabledImage( Constants::CONTROLL_BAR_IMAGE_DIR + "disabled" + Constants::CONTROLL_BAR_FORWARD );
    layout->insertWidget( 2, _forwardButton );

    _previewButton = new ToogleButton( _ui->_buttonContainer,
                                       Constants::CONTROLL_BAR_IMAGE_DIR + Constants::CONTROLL_BAR_PREVIEW,
                                       Constants::CONTROLL_BAR_IMAGE_DIR + "active" + Constants::CONTROLL_BAR_PREVIEW );
    _previewButton->setDisabledImage( Constants::CONTROLL_BAR_IMAGE_DIR + "disabled" + Constants::CONTROLL_BAR_PREVIEW );
    layout->insertWidget( 4, _previewButton );

    _snapshotButton = new CommandButton( _ui->_buttonContainer,
                                         Constants::CONTROLL_BAR_IMAGE_DIR + Constants::CONTROLL_BAR_SNAPSHOT );
    _snapshotButton->setMouseOverImage( Constants::CONTROLL_BAR_IMAGE_DIR + "active" + Constants::CONTROLL_BAR_SNAPSHOT );
    _snapshotButton->setDisabledImage( Constants::CONTROLL_BAR_IMAGE_DIR + "disabled" + Constants::CONTROLL_BAR_SNAPSHOT );
    layout->insertWidget( 5, _snapshotButton );

    _fullscreenButton = new ToogleButton( _ui->_buttonContainer,
                                          Constants::CONTROLL_BAR_IMAGE_DIR + Constants::CONTROLL_BAR_FULLSCREEN,
                                          Constants::CONTROLL_BAR_IMAGE_DIR + "active" + Constants::CONTROLL_BAR_FULLSCREEN );
    _fullscreenButton->setDisabledImage( Constants::CONTROLL_BAR_IMAGE_DIR + "disabled" + Constants::CONTROLL_BAR_FULLSCREEN );
    layout->insertWidget( 6, _fullscreenButton );

    _resolutionButton = new CommandButton( _ui->_buttonContainer,
                                           Constants::CONTROLL_BAR_IMAGE_DIR + Constants::CONTROLL_BAR_RESOLUTION );
    _resolutionButton->setMouseOverImage( Constants::CONTROLL_BAR_IMAGE_DIR + "active" + Constants::CONTROLL_BAR_RESOLUTION );
    _resolutionButton->setDisabledImage( Constants::CONTROLL_BAR_IMAGE_DIR + "disabled" + Constants::CONTROLL_BAR_RESOLUTION );
    layout->insertWidget( 7, _resolutionButton );

    _muteButton = new ToogleButton( _ui->_buttonContainer,
                                    Constants::CONTROLL_BAR_IMAGE_DIR + Constants::CONTROLL_BAR_VOLUME,
                                    Constants::CONTROLL_BAR_IMAGE_DIR + "active" + Constants::CONTROLL_BAR_VOLUME );
    _muteButton->setDisabledImage( Constants::CONTROLL_BAR_IMAGE_DIR + "disabled" + Constants::CONTROLL_BAR_VOLUME );
    layoutMuteButtons->insertWidget( 0, _muteButton );
}
开发者ID:baoping,项目名称:Red-Bull-Media-Player,代码行数:67,代码来源:ControllBarUI.cpp

示例7: QWidget

ChooseFolderView::ChooseFolderView( QWidget *parent ) : QWidget(parent) {

    QBoxLayout *layout = new QVBoxLayout(this);
    layout->setAlignment(Qt::AlignCenter);
    layout->setSpacing(PADDING);
    layout->setMargin(PADDING);

    welcomeLayout = new QHBoxLayout();
    welcomeLayout->setAlignment(Qt::AlignLeft);
    welcomeLayout->setSpacing(0);
    welcomeLayout->setMargin(0);
    layout->addLayout(welcomeLayout);

    QLabel *logo = new QLabel(this);
    logo->setPixmap(QPixmap(":/images/app.png"));
    welcomeLayout->addWidget(logo, 0, Qt::AlignTop);

    // hLayout->addSpacing(PADDING);

    QLabel *welcomeLabel =
            new QLabel("<h1>" +
                       tr("Welcome to <a href='%1'>%2</a>,")
                       .replace("<a ", "<a style='color:palette(text)'")
                       .arg(Constants::WEBSITE, Constants::APP_NAME)
                       + "</h1>", this);
    welcomeLabel->setOpenExternalLinks(true);
    welcomeLayout->addWidget(welcomeLabel);

    // layout->addSpacing(PADDING);

    tipLabel = new QLabel(
            tr("%1 needs to scan your music collection.").arg(Constants::APP_NAME)
            , this);
    tipLabel->setFont(FontUtils::big());
    layout->addWidget(tipLabel);

    QBoxLayout *buttonLayout = new QHBoxLayout();
    layout->addLayout(buttonLayout);

    cancelButton = new QPushButton(tr("Cancel"));
    connect(cancelButton, SIGNAL(clicked()), parent, SLOT(goBack()));
    buttonLayout->addWidget(cancelButton);

#ifdef APP_MAC_NO
    QPushButton *useiTunesDirButton = new QPushButton(tr("Use iTunes collection"));
    connect(useiTunesDirButton, SIGNAL(clicked()), SLOT(iTunesDirChosen()));
    useiTunesDirButton->setDefault(true);
    useiTunesDirButton->setFocus(Qt::NoFocusReason);
    buttonLayout->addWidget(useiTunesDirButton);
#endif

    QString musicLocation = QDesktopServices::storageLocation(QDesktopServices::MusicLocation);
    QString homeLocation = QDesktopServices::storageLocation(QDesktopServices::HomeLocation);
    if (QFile::exists(musicLocation) && musicLocation != homeLocation + "/") {
        QPushButton *useSystemDirButton = new QPushButton(tr("Use %1").arg(musicLocation));
        connect(useSystemDirButton, SIGNAL(clicked()), SLOT(systemDirChosen()));
#ifndef APP_MAC_NO
        useSystemDirButton->setDefault(true);
        useSystemDirButton->setFocus(Qt::NoFocusReason);
#endif
        buttonLayout->addWidget(useSystemDirButton);
    }

    QPushButton *chooseDirButton = new QPushButton(tr("Choose a folder..."));
    connect(chooseDirButton, SIGNAL(clicked()), SLOT(chooseFolder()));
    buttonLayout->addWidget(chooseDirButton);

#if !defined(APP_MAC) && !defined(Q_WS_WIN)
    QLabel *privacyLabel =
            new QLabel(
                    tr("%1 will connect to the Last.fm web services and pass artist names and album titles in order to fetch covert art, biographies and much more.")
                    .arg(Constants::APP_NAME) + " " +
                    tr("If you have privacy concerns about this you can quit now.")
                    , this);
    privacyLabel->setFont(FontUtils::small());
    privacyLabel->setOpenExternalLinks(true);
    privacyLabel->setWordWrap(true);
    layout->addWidget(privacyLabel);
#endif

}
开发者ID:junwatu,项目名称:junwatunes,代码行数:81,代码来源:choosefolderview.cpp

示例8: setMinimumSize

void
MyPluginGUI::createGUI(DefaultGUIModel::variable_t *var, int size)
{

  setMinimumSize(200, 300); // Qt API for setting window size

  //overall GUI layout with a "horizontal box" copied from DefaultGUIModel

  QBoxLayout *layout = new QHBoxLayout(this);

  //additional GUI layouts with "vertical" layouts that will later
  // be added to the overall "layout" above
  QBoxLayout *leftlayout = new QVBoxLayout();
  //QBoxLayout *rightlayout = new QVBoxLayout();

  // this is a "horizontal button group"
  QHButtonGroup *bttnGroup = new QHButtonGroup("Button Panel:", this);

  // we add two pushbuttons to the button group
  QPushButton *aBttn = new QPushButton("Button A", bttnGroup);
  QPushButton *bBttn = new QPushButton("Button B", bttnGroup);

  // clicked() is a Qt signal that is given to pushbuttons. The connect()
  // function links the clicked() event to a function that is defined
  // as a "private slot:" in the header.
  QObject::connect(aBttn, SIGNAL(clicked()), this, SLOT(aBttn_event()));
  QObject::connect(bBttn, SIGNAL(clicked()), this, SLOT(bBttn_event()));

  //these 3 utility buttons are copied from DefaultGUIModel
  QHBox *utilityBox = new QHBox(this);
  pauseButton = new QPushButton("Pause", utilityBox);
  pauseButton->setToggleButton(true);
  QObject::connect(pauseButton, SIGNAL(toggled(bool)), this, SLOT(pause(bool)));
  QPushButton *modifyButton = new QPushButton("Modify", utilityBox);
  QObject::connect(modifyButton, SIGNAL(clicked(void)), this, SLOT(modify(void)));
  QPushButton *unloadButton = new QPushButton("Unload", utilityBox);
  QObject::connect(unloadButton, SIGNAL(clicked(void)), this, SLOT(exit(void)));

  // add custom button group at the top of the layout
  leftlayout->addWidget(bttnGroup);

  // copied from DefaultGUIModel DO NOT EDIT
  // this generates the text boxes and labels
  QScrollView *sv = new QScrollView(this);
  sv->setResizePolicy(QScrollView::AutoOneFit);
  leftlayout->addWidget(sv);

  QWidget *viewport = new QWidget(sv->viewport());
  sv->addChild(viewport);
  QGridLayout *scrollLayout = new QGridLayout(viewport, 1, 2);

  size_t nstate = 0, nparam = 0, nevent = 0, ncomment = 0;
  for (size_t i = 0; i < num_vars; i++)
    {
      if (vars[i].flags & (PARAMETER | STATE | EVENT | COMMENT))
        {
          param_t param;

          param.label = new QLabel(vars[i].name, viewport);
          scrollLayout->addWidget(param.label, parameter.size(), 0);
          param.edit = new DefaultGUILineEdit(viewport);
          scrollLayout->addWidget(param.edit, parameter.size(), 1);

          QToolTip::add(param.label, vars[i].description);
          QToolTip::add(param.edit, vars[i].description);

          if (vars[i].flags & PARAMETER)
            {
              if (vars[i].flags & DOUBLE)
                {
                  param.edit->setValidator(new QDoubleValidator(param.edit));
                  param.type = PARAMETER | DOUBLE;
                }
              else if (vars[i].flags & UINTEGER)
                {
                  QIntValidator *validator = new QIntValidator(param.edit);
                  param.edit->setValidator(validator);
                  validator->setBottom(0);
                  param.type = PARAMETER | UINTEGER;
                }
              else if (vars[i].flags & INTEGER)
                {
                  param.edit->setValidator(new QIntValidator(param.edit));
                  param.type = PARAMETER | INTEGER;
                }
              else
                param.type = PARAMETER;
              param.index = nparam++;
              param.str_value = new QString;
            }
          else if (vars[i].flags & STATE)
            {
              param.edit->setReadOnly(true);
              param.edit->setPaletteForegroundColor(Qt::darkGray);
              param.type = STATE;
              param.index = nstate++;
            }
          else if (vars[i].flags & EVENT)
            {
              param.edit->setReadOnly(true);
//.........这里部分代码省略.........
开发者ID:El-Jefe,项目名称:plugin-template,代码行数:101,代码来源:my_plugin_gui.cpp

示例9: QWidget

OSDPretty::OSDPretty(Mode mode, QWidget* parent)
    : QWidget(parent),
      ui_(new Ui_OSDPretty),
      mode_(mode),
      background_color_(kPresetBlue),
      background_opacity_(0.85),
      popup_display_(0),
      font_(QFont()),
      disable_duration_(false),
      timeout_(new QTimer(this)),
      fading_enabled_(false),
      fader_(new QTimeLine(300, this)),
      toggle_mode_(false) {
  Qt::WindowFlags flags = Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint |
                          Qt::X11BypassWindowManagerHint;

  setWindowFlags(flags);
  setAttribute(Qt::WA_TranslucentBackground, true);
  setAttribute(Qt::WA_X11NetWmWindowTypeNotification, true);
  setAttribute(Qt::WA_ShowWithoutActivating, true);
  ui_->setupUi(this);

#ifdef Q_OS_WIN32
  // Don't show the window in the taskbar.  Qt::ToolTip does this too, but it
  // adds an extra ugly shadow.
  int ex_style = GetWindowLong(winId(), GWL_EXSTYLE);
  ex_style |= WS_EX_NOACTIVATE;
  SetWindowLong(winId(), GWL_EXSTYLE, ex_style);
#endif

  // Mode settings
  switch (mode_) {
    case Mode_Popup:
      setCursor(QCursor(Qt::ArrowCursor));
      break;

    case Mode_Draggable:
      setCursor(QCursor(Qt::OpenHandCursor));
      break;
  }

  // Timeout
  timeout_->setSingleShot(true);
  timeout_->setInterval(5000);
  connect(timeout_, SIGNAL(timeout()), SLOT(hide()));

  ui_->icon->setMaximumSize(kMaxIconSize, kMaxIconSize);

  // Fader
  connect(fader_, SIGNAL(valueChanged(qreal)), SLOT(FaderValueChanged(qreal)));
  connect(fader_, SIGNAL(finished()), SLOT(FaderFinished()));

#ifdef Q_OS_WIN32
  set_fading_enabled(true);
#endif

  // Load the show edges and corners
  QImage shadow_edge(":osd_shadow_edge.png");
  QImage shadow_corner(":osd_shadow_corner.png");
  for (int i = 0; i < 4; ++i) {
    QTransform rotation = QTransform().rotate(90 * i);
    shadow_edge_[i] = QPixmap::fromImage(shadow_edge.transformed(rotation));
    shadow_corner_[i] = QPixmap::fromImage(shadow_corner.transformed(rotation));
  }
  background_ = QPixmap(":osd_background.png");

  // Set the margins to allow for the drop shadow
  QBoxLayout* l = static_cast<QBoxLayout*>(layout());
  int margin = l->margin() + kDropShadowSize;
  l->setMargin(margin);

  // Get current screen resolution
  QRect screenResolution = QApplication::desktop()->screenGeometry();
  // Leave 200 px for icon
  ui_->summary->setMaximumWidth(screenResolution.width() - 200);
  ui_->message->setMaximumWidth(screenResolution.width() - 200);
  // Set maximum size for the OSD, a little margin here too
  setMaximumSize(screenResolution.width() - 100,
                 screenResolution.height() - 100);

  // Don't load settings here, they will be reloaded anyway on creation
}
开发者ID:Aceler,项目名称:Clementine,代码行数:82,代码来源:osdpretty.cpp

示例10: QWidget


//.........这里部分代码省略.........
	bookmarksContextMenu_->addAction(tr("Remove From List"), this, SLOT(removeBookmark()));
	bookmarksContextMenu_->addSeparator();
	bookmarksShowFullPathAction_ = bookmarksContextMenu_->addAction(tr("Show Full Path"));
	bookmarksShowFullPathAction_->setCheckable(true);
	bookmarksShowFullPathAction_->setChecked(bookmarksModel_->pathReduction() == -1);
	connect(bookmarksShowFullPathAction_, SIGNAL(toggled(bool)), this, SLOT(bookmarksShowFullPath(bool)));
	
	#ifdef Q_WS_MAC
	{
		QProxyStyle* proxyStyle = qobject_cast<QProxyStyle*>(style());
		QMacStyle* macStyle = qobject_cast<QMacStyle*>((proxyStyle) ? proxyStyle->baseStyle() : style());
		if (macStyle) {
			macStyle->setFocusRectPolicy(dirView_, QMacStyle::FocusDisabled);
			macStyle->setFocusRectPolicy(recentView_, QMacStyle::FocusDisabled);
			macStyle->setFocusRectPolicy(dirView_, QMacStyle::FocusDisabled);
			macStyle->setFocusRectPolicy(bookmarksView_, QMacStyle::FocusDisabled);
		}
	}
	#endif
	
	//--------------------------------------------------------------------------
	// layout widgets
	
	handle_ = new QxControl(this, new QxVisual(styleManager()->style("fileBrowserSplitter")));
	handle_->visual()->setText("");
	handleTextRecent_ = tr("Recent Places");
	handleTextBookmarks_ = tr("Bookmarks");
	
	bottomStack_ = new QxControl(this);
	bottomStackLayout_ = new QStackedLayout;
	bottomStackLayout_->addWidget(recentView_);
	bottomStackLayout_->addWidget(bookmarksView_);
	bottomStack_->setLayout(bottomStackLayout_);
	bottomStack_->setVisible(false);
	
	splitter_ = new QxSplitter(this);
	splitter_->setOrientation(Qt::Vertical);
	splitter_->setHandle(1, handle_);
	splitter_->setHandleWidth(styleManager()->constant("fileBrowserSplitterWidth"));
	splitter_->addWidget(dirView_);
	/*{
		QxControl* carrier = new QxControl(this, new QxVisual(styleManager()->style("fileBrowserDirView")));
		QGridLayout* layout = new QGridLayout;
		layout->setSpacing(0);
		layout->setMargin(0);
		layout->addWidget(dirView_);
		carrier->setLayout(layout);
		splitter_->addWidget(carrier);
	}*/
	splitter_->addWidget(bottomStack_);
	
	// make dirView_ grow/shrink dynamically, while bottomStack_ keeps user-defined size
	splitter_->setStretchFactor(0, 1);
	splitter_->setStretchFactor(1, 0);
	
	QDockWidget* dock = qobject_cast<QDockWidget*>(parent);
	if (dock) {
		dock->setWidget(this);
		// connect(dock, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(adaptToDockLocation(Qt::DockWidgetArea)));
	}
	
	QVBoxLayout* col = new QVBoxLayout;
	col->setSpacing(0);
	col->setMargin(0);
	{
		QxControl* carrier = new QxControl(parent, new QxVisual(styleManager()->style("fileBrowserNavCarrier")));
		QHBoxLayout* row = new QHBoxLayout;
		row->setSpacing(0);
		row->setMargin(0);
		row->addWidget(gotoButton_);
		row->addStretch();
		row->addWidget(cdUpButton);
		carrier->setLayout(row);
		
		if (dock)
			dock->setTitleBarWidget(carrier);
		else
			col->addWidget(carrier);
	}
	col->addWidget(splitter_);
	col->addWidget(styleManager()->hl(this));
	{
		QBoxLayout* row = new QBoxLayout(QBoxLayout::LeftToRight);
		row->setSpacing(0);
		row->setMargin(0);
		row->addWidget(plusButton);
		row->addWidget(styleManager()->vl(this));
		row->addWidget(wheelButton);
		row->addWidget(styleManager()->vl(this));
		row->addWidget(recentButton);
		row->addWidget(styleManager()->vl(this));
		row->addWidget(bookmarksButton);
		row->addWidget(styleManager()->vl(this));
		row->addWidget(statusBar_);
		col->addLayout(row);
		
		bottomToolLayout_ = row;
	}
	setLayout(col);
}
开发者ID:corelon,项目名称:paco,代码行数:101,代码来源:QxFileBrowser.cpp

示例11: QDialog

TileSelectDialog::TileSelectDialog (QWidget* parent)
  : QDialog (parent)
{
  QBoxLayout* layout = new QBoxLayout (QBoxLayout::TopToBottom, this);

  QRadioButton* radio_button = new QRadioButton ("Load Tile", this);
  radio_button->setChecked (true);
  layout->addWidget (radio_button);
  connect (radio_button, SIGNAL (toggled (bool)),
           this, SLOT (load_tile_toggled (bool)));

  _load_tile_frame = new QFrame (this);
  layout->addWidget (_load_tile_frame);

  QBoxLayout* box_layout = new QBoxLayout (QBoxLayout::LeftToRight,
                                           _load_tile_frame);

  _load_tile_line_edit = new QLineEdit (_load_tile_frame);
  box_layout->addWidget (_load_tile_line_edit);

  QPushButton* button = new QPushButton ("Choose", _load_tile_frame);
  box_layout->addWidget (button);
  connect (button, SIGNAL (pressed ()),
           this, SLOT (choose_button_pressed ()));

  radio_button = new QRadioButton ("Custom Tile", this);
  layout->addWidget (radio_button);

  _custom_tile_frame = new QFrame (this);
  _custom_tile_frame->setEnabled (false);
  layout->addWidget (_custom_tile_frame);
  connect (radio_button, SIGNAL (toggled (bool)),
           this, SLOT (custom_tile_toggled (bool)));

  QGridLayout* grid_layout = new QGridLayout (_custom_tile_frame);

  grid_layout->addWidget (new QLabel ("Size", _custom_tile_frame), 0, 0);

  _width_line_edit = new QLineEdit ("1", _custom_tile_frame);
  grid_layout->addWidget (_width_line_edit, 1, 0);

  grid_layout->addWidget (new QLabel ("x", _custom_tile_frame), 1, 1);

  _height_line_edit = new QLineEdit ("1", _custom_tile_frame);
  grid_layout->addWidget (_height_line_edit, 1, 2);

  grid_layout->addWidget (new QLabel ("Text", _custom_tile_frame), 2, 0);

  _text_line_edit = new QLineEdit (_custom_tile_frame);
  grid_layout->addWidget (_text_line_edit, 3, 0, 1, 3);

  box_layout = new QBoxLayout (QBoxLayout::RightToLeft);
  layout->addLayout (box_layout);

  button = new QPushButton ("&Ok", this);
  button->setDefault (true);
  connect (button, SIGNAL (pressed ()), this, SLOT (verify_input ()));
  box_layout->addWidget (button);

  button = new QPushButton ("&Cancel", this);
  connect (button, SIGNAL (pressed ()), this, SLOT (reject ()));
  box_layout->addWidget (button);
}
开发者ID:soxslayer,项目名称:dnd-slate,代码行数:63,代码来源:tile_select_dialog.cpp

示例12: QWidget

KDMUsersWidget::KDMUsersWidget( QWidget *parent )
	: QWidget( parent )
{
#ifdef __linux__
	struct stat st;
	if (!stat( "/etc/debian_version", &st )) { /* debian */
		defminuid = "1000";
		defmaxuid = "29999";
	} else if (!stat( "/usr/portage", &st )) { /* gentoo */
		defminuid = "1000";
		defmaxuid = "65000";
	} else if (!stat( "/etc/mandrake-release", &st )) { /* mandrake - check before redhat! */
		defminuid = "500";
		defmaxuid = "65000";
	} else if (!stat( "/etc/redhat-release", &st )) { /* redhat */
		defminuid = "100";
		defmaxuid = "65000";
	} else /* if (!stat( "/etc/SuSE-release", &st )) */ { /* suse */
		defminuid = "500";
		defmaxuid = "65000";
	}
#else
	defminuid = "1000";
	defmaxuid = "65000";
#endif

	// We assume that $kde_datadir/kdm exists, but better check for pics/ and pics/users,
	// and create them if necessary.
	m_userPixDir = config->group("X-*-Greeter").readEntry( "FaceDir", KGlobal::dirs()->resourceDirs( "data" ).last() + "kdm/faces" ) + '/';
	QDir testDir( m_userPixDir );
	if (!testDir.exists() && !testDir.mkdir( testDir.absolutePath() ) && !geteuid())
		KMessageBox::sorry( this, i18n("Unable to create folder %1", testDir.absolutePath() ) );
	if (!getpwnam( "nobody" ) && !geteuid())
		KMessageBox::sorry( this,
			i18n("User 'nobody' does not exist. "
			     "Displaying user images will not work in KDM.") );

	m_defaultText = i18n("<placeholder>default</placeholder>");

	QString wtstr;

	minGroup = new QGroupBox( i18n("System U&IDs"), this );
	minGroup->setWhatsThis( i18n("Users with a UID (numerical user identification) outside this range will not be listed by KDM and this setup dialog."
	                             " Note that users with the UID 0 (typically root) are not affected by this and must be"
	                             " explicitly hidden in \"Not hidden\" mode.") );
	QSizePolicy sp_ign_fix( QSizePolicy::Ignored, QSizePolicy::Fixed );
	QValidator *valid = new QIntValidator( 0, 999999, minGroup );
	QLabel *minlab = new QLabel( i18n("Below:"), minGroup );
	leminuid = new KLineEdit( minGroup );
	minlab->setBuddy( leminuid );
	leminuid->setSizePolicy( sp_ign_fix );
	leminuid->setValidator( valid );
	connect( leminuid, SIGNAL(textChanged( const QString & )), SIGNAL(changed()) );
	connect( leminuid, SIGNAL(textChanged( const QString & )), SLOT(slotMinMaxChanged()) );
	QLabel *maxlab = new QLabel( i18n("Above:"), minGroup );
	lemaxuid = new KLineEdit( minGroup );
	maxlab->setBuddy( lemaxuid );
	lemaxuid->setSizePolicy( sp_ign_fix );
	lemaxuid->setValidator( valid );
	connect( lemaxuid, SIGNAL(textChanged( const QString & )), SIGNAL(changed()) );
	connect( lemaxuid, SIGNAL(textChanged( const QString & )), SLOT(slotMinMaxChanged()) );
	QGridLayout *grid = new QGridLayout( minGroup );
	grid->addWidget( minlab, 0, 0 );
	grid->addWidget( leminuid, 0, 1 );
	grid->addWidget( maxlab, 1, 0 );
	grid->addWidget( lemaxuid, 1, 1 );

	usrGroup = new QGroupBox( i18n("Users"), this );
	cbshowlist = new QCheckBox( i18n("Show list"), usrGroup );
	cbshowlist->setWhatsThis( i18n("If this option is checked, KDM will show a list of users,"
	                               " so users can click on their name or image rather than typing in their login.") );
	cbcomplete = new QCheckBox( i18n("Autocompletion"), usrGroup );
	cbcomplete->setWhatsThis( i18n("If this option is checked, KDM will automatically complete"
	                               " user names while they are typed in the line edit.") );
	cbinverted = new QCheckBox( i18n("Inverse selection"), usrGroup );
	cbinverted->setWhatsThis( i18n("This option specifies how the users for \"Show list\" and \"Autocompletion\""
	                               " are selected in the \"Select users and groups\" list: "
	                               "If not checked, select only the checked users. "
	                               "If checked, select all non-system users, except the checked ones.") );
	cbusrsrt = new QCheckBox( i18n("Sor&t users"), usrGroup );
	cbusrsrt->setWhatsThis( i18n("If this is checked, KDM will alphabetically sort the user list."
	                             " Otherwise users are listed in the order they appear in the password file.") );
	QButtonGroup *buttonGroup = new QButtonGroup( usrGroup );
	buttonGroup->setExclusive( false );
	connect( buttonGroup, SIGNAL(buttonClicked( int )), SLOT(slotShowOpts()) );
	connect( buttonGroup, SIGNAL(buttonClicked( int )), SIGNAL(changed()) );
	buttonGroup->addButton( cbshowlist );
	buttonGroup->addButton( cbcomplete );
	buttonGroup->addButton( cbinverted );
	buttonGroup->addButton( cbusrsrt );
	QBoxLayout *box = new QVBoxLayout( usrGroup );
	box->addWidget( cbshowlist );
	box->addWidget( cbcomplete );
	box->addWidget( cbinverted );
	box->addWidget( cbusrsrt );

	wstack = new QStackedWidget( this );
	s_label = new QLabel( i18n("S&elect users and groups:"), this );
	s_label->setBuddy( wstack );
	optinlv = new K3ListView( this );
//.........这里部分代码省略.........
开发者ID:jschwartzenberg,项目名称:kicker,代码行数:101,代码来源:kdm-users.cpp

示例13: QFrame

ClsQGroupStateManip::ClsQGroupStateManip ( const char * _name = 0,string _strGroupID = ""):
    QFrame( 0, _name, Qt::WDestructiveClose), strGroupID(_strGroupID) {

    bApplied = false;
    clsQStateArrayView = NULL;
    iInterval = 1;
    iLoops = 1;
    iStepSize = 1;


    string strGroupName = ClsFESystemManager::Instance()->getGroupName(strGroupID).c_str();
    string strTitle = "State Manipulation Panel for \"" + strGroupName + "\"";
    this->setCaption(strTitle.c_str());


    QBitmap qbmEraser(  eraser_cursor_width,  eraser_cursor_height,  eraser_cursor_bits, TRUE );
    QBitmap qbmEraserMask(  eraser_cursor_mask_width,  eraser_cursor_mask_height,  eraser_cursor_mask_bits, TRUE );
    qcursorEraser = new QCursor( qbmEraser, qbmEraserMask,0 ,0 ); 

    QBitmap qbmPencil(  pencil_cursor_width,  pencil_cursor_height,  pencil_cursor_bits, TRUE );
    QBitmap qbmPencilMask(  pencil_cursor_mask_width,  pencil_cursor_mask_height,  pencil_cursor_mask_bits, TRUE );
    qcursorPencil = new QCursor( qbmPencil, qbmPencilMask, 0, 0 ); 

    QSplitter *qsplitter = new QSplitter(this);
    QFrame *qfmLeftPane = new QFrame(qsplitter);

    QBoxLayout * layoutMain = new QHBoxLayout( this);
    layoutMain->setResizeMode (QLayout::Fixed);
    layoutMain->addWidget(qsplitter);



    QBoxLayout * layoutLeftPane = new QVBoxLayout( qfmLeftPane, 5, -1, "mainL");

    qlblCaption = new QLabel(qfmLeftPane);
    qlblCaption->setText(strGroupName.c_str());

    layoutLeftPane->addWidget(qlblCaption);

    qfmStateArray = new QFrame(qfmLeftPane);;
    QHBoxLayout *qlayoutQfm = new QHBoxLayout( qfmStateArray);
    qlayoutQfm->setAutoAdd ( true);

    createStateArray(strGroupID);
    layoutLeftPane->addWidget(qfmStateArray, 0, Qt::AlignHCenter);
    qfmStateArray->show();
    clsQStateArrayView->show();
    clsQStateArrayView->setValue(DEFAULTVALUE);

    QHBoxLayout *qlayoutGradient = new QHBoxLayout( layoutLeftPane);

    QString qstr;

    QLabel* qlblMin = new QLabel(qfmLeftPane);
    qstr.setNum(fMinVal());

    qlblMin->setText(qstr);
    qlayoutGradient->addWidget(qlblMin, 0, Qt::AlignRight);

    qlblGradientPixmap = new QLabel(qfmLeftPane);;
    qlayoutGradient->addWidget(qlblGradientPixmap, 1, Qt::AlignHCenter);

    qstr.setNum(fMaxVal());
    QLabel* qlblMax = new QLabel(qfmLeftPane);
    qlblMax->setText(qstr);
    qlayoutGradient->addWidget(qlblMax);

    int iImgWidth = clsQStateArrayView->width() - qlblMin->minimumWidth() - qlblMax->minimumWidth() - 30;
    int iImgHeight = 13;
    qlblGradientPixmap->setFixedSize(iImgWidth,iImgHeight);
    qlblGradientPixmap->setPixmap(clsQStateArrayView->getGradientPixmap(iImgWidth, iImgHeight));

/* -------------------------------- */
    qgrpbxTools = new QGroupBox( );

    QLabel *lblValue = new QLabel();
    lblValue->setText("Value:");

    qdblspnbx = new QDoubleSpinBox( qgrpbxTools );
    qdblspnbx->setMinimum(fMinVal());
    qdblspnbx->setMaximum(fMaxVal());
    qdblspnbx->setDecimals(3);
    qdblspnbx->setSingleStep ( 0.01);
    qdblspnbx->setValue(DEFAULTVALUE);
    connect(qdblspnbx, SIGNAL(valueChanged(double)), this, SLOT(slotChangeValue(double)));

    QPushButton* qpbtnPen = new QPushButton (QIcon(QPixmap(pencil)), "");
    qpbtnPen->setToggleButton ( true);
    qpbtnPen->setFlat(true);
    qpbtnPen->setChecked(true);

    slotSelectTool(TOOL_PENCIL);


    QPushButton* qpbtnEraser = new QPushButton (QIcon(QPixmap(eraser)), "");
    qpbtnEraser->setToggleButton ( true);
    qpbtnEraser->setFlat(true);

    QHBoxLayout *qlayoutTools = new QHBoxLayout;
    qlayoutTools->addWidget(lblValue);
//.........这里部分代码省略.........
开发者ID:jeez,项目名称:iqr,代码行数:101,代码来源:ClsQGroupStateManip.cpp

示例14: QLabel

GNumericalExpressionSettingsWidget::GNumericalExpressionSettingsWidget( GNumericalExpression* numericalExpression, QObject* parent /*= NULL*/)	
{
	m_NumericalExpression = numericalExpression;

	QGroupBox* pExpressionSettings = new QGroupBox;
	QBoxLayout* pExpressionSettingsLayout = new QVBoxLayout;
	QBoxLayout* pExpressionEditLayout = new QHBoxLayout;
	pExpressionSettings->setFixedWidth(400);
	pExpressionSettings->setTitle("Expression Settings");
	pExpressionSettings->setLayout(pExpressionSettingsLayout);
	pExpressionEditLayout->insertWidget(0, new QLabel("Expression:"), 0);
	pExpressionEditLayout->insertWidget(1, m_NumericalExpression->m_Expression.ProvideNewParamLineEdit(pExpressionSettings), 0);
	pExpressionSettingsLayout->insertLayout(0, pExpressionEditLayout);

	QGroupBox* pVariableSettings = new QGroupBox;
	QGroupBox* pShowVariables = new QGroupBox;
	QBoxLayout* pShowVariablesLayout = new QVBoxLayout;
	QBoxLayout* pVariableSettingsLayout = new QVBoxLayout;
	QRadioButton* pLayoutVariablesVertically = new QRadioButton;
	QRadioButton* pLayoutVariablesHorizontally = new QRadioButton;
	QRadioButton* pLayoutVariablesGrid = new QRadioButton;
	pVariableSettings->setFixedWidth(400);
	pVariableSettings->setTitle("Variable Settings");
	pVariableSettings->setLayout(pVariableSettingsLayout);
	pShowVariables->setTitle("Show Variables");
	pShowVariables->setCheckable(true);
	pShowVariables->setLayout(pShowVariablesLayout);
	pLayoutVariablesHorizontally->setText("Layout: Horizontal");
	pShowVariablesLayout->insertWidget(0, pLayoutVariablesHorizontally);
	pLayoutVariablesVertically->setText("Layout: Vertical");
	pShowVariablesLayout->insertWidget(1, pLayoutVariablesVertically);
	pLayoutVariablesGrid->setText("Layout: Grid");
	pShowVariablesLayout->insertWidget(2, pLayoutVariablesGrid);
	pVariableSettingsLayout->insertWidget(0, pShowVariables);
	
	QPushButton* pAcceptButton = new QPushButton;
	QPushButton* pCloseButton = new QPushButton;
	QBoxLayout* pButtonLayout = new QHBoxLayout;
	pAcceptButton->setText("Accept");
	connect(pAcceptButton, SIGNAL(clicked(bool)), this, SLOT(Accept()));
	pCloseButton->setText("Close");
	connect(pCloseButton, SIGNAL(clicked(bool)), this, SLOT(close()));
	pButtonLayout->insertWidget(0, pAcceptButton, 1);
	pButtonLayout->insertWidget(1, pCloseButton, 1);

	QBoxLayout* pMainLayout = new QVBoxLayout;
	pMainLayout->setSizeConstraint(QLayout::SetFixedSize);
	setLayout(pMainLayout);
	pMainLayout->insertWidget(0, pExpressionSettings, 1);
	pMainLayout->insertWidget(1, pVariableSettings, 1);
	pMainLayout->insertLayout(2, pButtonLayout, 0);
}
开发者ID:,项目名称:,代码行数:52,代码来源:

示例15: QWidget

QgsMapStylingWidget::QgsMapStylingWidget( QgsMapCanvas* canvas, QWidget *parent )
    : QWidget( parent )
    , mMapCanvas( canvas )
    , mBlockAutoApply( false )
    , mCurrentLayer( nullptr )
    , mVectorStyleWidget( nullptr )
{
  QBoxLayout* layout = new QVBoxLayout();
  layout->setContentsMargins( 0, 0, 0, 0 );
  this->setLayout( layout );

  mAutoApplyTimer = new QTimer( this );
  mAutoApplyTimer->setSingleShot( true );
  connect( mAutoApplyTimer, SIGNAL( timeout() ), this, SLOT( apply() ) );

  mStackedWidget = new QStackedWidget( this );
  mMapStyleTabs = new QTabWidget( this );
  mMapStyleTabs->setDocumentMode( true );
  mNotSupportedPage = mStackedWidget->addWidget( new QLabel( "Not supported currently" ) );
  mVectorPage = mStackedWidget->addWidget( mMapStyleTabs );

  // create undo widget
  mUndoWidget = new QgsUndoWidget( this->mMapStyleTabs, mMapCanvas );
  mUndoWidget->setObjectName( "Undo Styles" );

  mLayerTitleLabel = new QLabel();
  mLayerTitleLabel->setAlignment( Qt::AlignHCenter );
  layout->addWidget( mLayerTitleLabel );
  layout->addWidget( mStackedWidget );
  mButtonBox = new QDialogButtonBox( QDialogButtonBox::Apply );
  mLiveApplyCheck = new QCheckBox( "Live update" );
  mLiveApplyCheck->setChecked( true );

  mUndoButton = new QToolButton( this );
  mUndoButton->setIcon( QgsApplication::getThemeIcon( "mActionUndo.png" ) );
  mRedoButton = new QToolButton( this );
  mRedoButton->setIcon( QgsApplication::getThemeIcon( "mActionRedo.png" ) );

  connect( mUndoButton, SIGNAL( pressed() ), mUndoWidget, SLOT( undo() ) );
  connect( mRedoButton, SIGNAL( pressed() ), mUndoWidget, SLOT( redo() ) );

  QHBoxLayout* bottomLayout = new QHBoxLayout( );
  bottomLayout->addWidget( mUndoButton );
  bottomLayout->addWidget( mRedoButton );
  bottomLayout->addWidget( mButtonBox );
  bottomLayout->addWidget( mLiveApplyCheck );
  layout->addLayout( bottomLayout );

  mLabelingWidget = new QgsLabelingWidget( 0, mMapCanvas, this );
  mLabelingWidget->setDockMode( true );
  connect( mLabelingWidget, SIGNAL( widgetChanged() ), this, SLOT( autoApply() ) );

  // Only labels for now but styles and diagrams will come later
  QScrollArea* stylescroll = new QScrollArea;
  stylescroll->setWidgetResizable( true );
  stylescroll->setFrameStyle( QFrame::NoFrame );
  QScrollArea* labelscroll = new QScrollArea;
  labelscroll->setWidgetResizable( true );
  labelscroll->setFrameStyle( QFrame::NoFrame );
  labelscroll->setWidget( mLabelingWidget );

  mStyleTabIndex = mMapStyleTabs->addTab( stylescroll, QgsApplication::getThemeIcon( "propertyicons/symbology.png" ), "Styles" );
  mLabelTabIndex = mMapStyleTabs->addTab( labelscroll, QgsApplication::getThemeIcon( "labelingSingle.svg" ), "Labeling" );
  mMapStyleTabs->addTab( mUndoWidget, QgsApplication::getThemeIcon( "labelingSingle.svg" ), "History" );
//  int diagramTabIndex = mMapStyleTabs->addTab( new QWidget(), QgsApplication::getThemeIcon( "propertyicons/diagram.png" ), "Diagrams" );
//  mMapStyleTabs->setTabEnabled( styleTabIndex, false );
//  mMapStyleTabs->setTabEnabled( diagramTabIndex, false );
  mMapStyleTabs->setCurrentIndex( mStyleTabIndex );

  connect( mMapStyleTabs, SIGNAL( currentChanged( int ) ), this, SLOT( updateCurrentWidgetLayer( int ) ) );

  connect( mLiveApplyCheck, SIGNAL( toggled( bool ) ), mButtonBox->button( QDialogButtonBox::Apply ), SLOT( setDisabled( bool ) ) );

  connect( mButtonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) );

  mButtonBox->button( QDialogButtonBox::Apply )->setEnabled( false );

}
开发者ID:danylaksono,项目名称:QGIS,代码行数:78,代码来源:qgsmapstylingwidget.cpp


注:本文中的QBoxLayout类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。