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


C++ QBoxLayout::addWidget方法代码示例

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


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

示例1: KCModule

KMovingConfig::KMovingConfig (bool _standAlone, KConfig *_config, const KComponentData &inst, QWidget *parent)
    : KCModule(inst, parent), config(_config), standAlone(_standAlone)
{
    QString wtstr;
    QBoxLayout *lay = new QVBoxLayout (this);

    windowsBox = new KButtonGroup(this);
    windowsBox->setTitle(i18n("Windows"));

    QBoxLayout *wLay = new QVBoxLayout (windowsBox);

    QBoxLayout *bLay = new QVBoxLayout;
    wLay->addLayout(bLay);

    opaque = new QCheckBox(i18n("Di&splay content in moving windows"), windowsBox);
    bLay->addWidget(opaque);
    opaque->setWhatsThis( i18n("Enable this option if you want a window's content to be fully shown"
                                  " while moving it, instead of just showing a window 'skeleton'. The result may not be satisfying"
                                  " on slow machines without graphic acceleration.") );

    resizeOpaqueOn = new QCheckBox(i18n("Display content in &resizing windows"), windowsBox);
    bLay->addWidget(resizeOpaqueOn);
    resizeOpaqueOn->setWhatsThis( i18n("Enable this option if you want a window's content to be shown"
                                          " while resizing it, instead of just showing a window 'skeleton'. The result may not be satisfying"
                                          " on slow machines.") );

    geometryTipOn = new QCheckBox(i18n("Display window &geometry when moving or resizing"), windowsBox);
    bLay->addWidget(geometryTipOn);
    geometryTipOn->setWhatsThis( i18n("Enable this option if you want a window's geometry to be displayed"
                                        " while it is being moved or resized. The window position relative"
                                        " to the top-left corner of the screen is displayed together with"
                                        " its size."));

    QGridLayout *rLay = new QGridLayout();
    bLay->addLayout(rLay);
    rLay->setColumnStretch(0,0);
    rLay->setColumnStretch(1,1);

    moveResizeMaximized = new QCheckBox( i18n("Allow moving and resizing o&f maximized windows"), windowsBox);
    bLay->addWidget(moveResizeMaximized);
    moveResizeMaximized->setWhatsThis( i18n("When enabled, this feature activates the border of maximized windows"
                                              " and allows you to move or resize them,"
                                              " just like for normal windows"));


    bLay->addSpacing(10);

    lay->addWidget(windowsBox);

    //iTLabel = new QLabel(i18n("  Allowed overlap:\n"
    //                         "(% of desktop space)"),
    //             plcBox);
    //iTLabel->setAlignment(AlignTop|AlignHCenter);
    //pLay->addWidget(iTLabel,1,1);

    //interactiveTrigger = new QSpinBox(0, 500, 1, plcBox);
    //pLay->addWidget(interactiveTrigger,1,2);

    //pLay->addRowSpacing(2,KDialog::spacingHint());

    //lay->addWidget(plcBox);





    //CT 15mar98 - add EdgeResistance, BorderAttractor, WindowsAttractor config
    MagicBox = new KButtonGroup(this);
    MagicBox->setTitle(i18n("Snap Zones"));
    QGridLayout *kLay = new QGridLayout(MagicBox);

    BrdrSnap = new KIntNumInput(10, MagicBox);
    BrdrSnap->setSpecialValueText( i18n("none") );
    BrdrSnap->setRange( 0, MAX_BRDR_SNAP);
    BrdrSnap->setSteps(1,10);
    BrdrSnap->setWhatsThis( i18n("Here you can set the snap zone for screen borders, i.e."
                                    " the 'strength' of the magnetic field which will make windows snap to the border when"
                                    " moved near it.") );
    BrdrSnap->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    BrdrSnapLabel = new QLabel(i18n("&Border snap zone:"), this);
    BrdrSnapLabel->setAlignment(Qt::AlignVCenter|Qt::AlignRight);
    BrdrSnapLabel->setBuddy(BrdrSnap);
    kLay->addWidget(BrdrSnapLabel, 0, 0);
    kLay->addWidget(BrdrSnap, 0, 1);

    WndwSnap = new KIntNumInput(10, MagicBox);
    WndwSnap->setSpecialValueText( i18n("none") );
    WndwSnap->setRange( 0, MAX_WNDW_SNAP);
    WndwSnap->setSteps(1,10);
    WndwSnap->setWhatsThis( i18n("Here you can set the snap zone for windows, i.e."
                                    " the 'strength' of the magnetic field which will make windows snap to each other when"
                                    " they are moved near another window.") );
    BrdrSnap->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    WndwSnapLabel = new QLabel(i18n("&Window snap zone:"), this);
    WndwSnapLabel->setAlignment(Qt::AlignVCenter|Qt::AlignRight);
    WndwSnapLabel->setBuddy(WndwSnap);
    kLay->addWidget(WndwSnapLabel, 1, 0);
    kLay->addWidget(WndwSnap, 1, 1);

    CntrSnap = new KIntNumInput(10, MagicBox);
//.........这里部分代码省略.........
开发者ID:lmurray,项目名称:kwin,代码行数:101,代码来源:windows.cpp

示例2: display

/******************************************************************************
*  Display the Find dialog.
*/
void Find::display()
{
    if(!mOptions)
        // Set defaults the first time the Find dialog is activated
        mOptions = FIND_LIVE | FIND_EXPIRED | FIND_MESSAGE | FIND_FILE | FIND_COMMAND | FIND_EMAIL;
    bool noExpired = !Preferences::expiredKeepDays();
    bool showExpired = mListView->isA("AlarmListView") && ((AlarmListView *)mListView)->showingExpired();
    if(noExpired  ||  !showExpired)       // these settings could change between activations
        mOptions &= ~FIND_EXPIRED;

    if(mDialog)
    {
        KWin::activateWindow(mDialog->winId());
    }
    else
    {
#ifdef MODAL_FIND
        mDialog = new KFindDialog(mListView, "FindDlg", mOptions, mHistory, (mListView->selectedCount() > 1));
#else
        mDialog = new KFindDialog(false, mListView, "FindDlg", mOptions, mHistory, (mListView->selectedCount() > 1));
#endif
        mDialog->setHasSelection(false);
        QWidget *kalarmWidgets = mDialog->findExtension();

        // Alarm types
        QBoxLayout *layout = new QVBoxLayout(kalarmWidgets, 0, KDialog::spacingHint());
        QGroupBox *group = new QGroupBox(i18n("Alarm Type"), kalarmWidgets);
        layout->addWidget(group);
        QGridLayout *grid = new QGridLayout(group, 2, 2, KDialog::marginHint(), KDialog::spacingHint());
        grid->addRowSpacing(0, mDialog->fontMetrics().lineSpacing() / 2);
        grid->setColStretch(1, 1);

        // Live & expired alarm selection
        mLive = new QCheckBox(i18n("Acti&ve"), group);
        mLive->setFixedSize(mLive->sizeHint());
        QWhatsThis::add(mLive, i18n("Check to include active alarms in the search."));
        grid->addWidget(mLive, 1, 0, Qt::AlignAuto);

        mExpired = new QCheckBox(i18n("Ex&pired"), group);
        mExpired->setFixedSize(mExpired->sizeHint());
        QWhatsThis::add(mExpired,
                        i18n("Check to include expired alarms in the search. "
                             "This option is only available if expired alarms are currently being displayed."));
        grid->addWidget(mExpired, 1, 2, Qt::AlignAuto);

        mActiveExpiredSep = new KSeparator(Qt::Horizontal, kalarmWidgets);
        grid->addMultiCellWidget(mActiveExpiredSep, 2, 2, 0, 2);

        // Alarm actions
        mMessageType = new QCheckBox(i18n("Text"), group, "message");
        mMessageType->setFixedSize(mMessageType->sizeHint());
        QWhatsThis::add(mMessageType, i18n("Check to include text message alarms in the search."));
        grid->addWidget(mMessageType, 3, 0);

        mFileType = new QCheckBox(i18n("Fi&le"), group, "file");
        mFileType->setFixedSize(mFileType->sizeHint());
        QWhatsThis::add(mFileType, i18n("Check to include file alarms in the search."));
        grid->addWidget(mFileType, 3, 2);

        mCommandType = new QCheckBox(i18n("Co&mmand"), group, "command");
        mCommandType->setFixedSize(mCommandType->sizeHint());
        QWhatsThis::add(mCommandType, i18n("Check to include command alarms in the search."));
        grid->addWidget(mCommandType, 4, 0);

        mEmailType = new QCheckBox(i18n("&Email"), group, "email");
        mEmailType->setFixedSize(mEmailType->sizeHint());
        QWhatsThis::add(mEmailType, i18n("Check to include email alarms in the search."));
        grid->addWidget(mEmailType, 4, 2);

        // Set defaults
        mLive->setChecked(mOptions & FIND_LIVE);
        mExpired->setChecked(mOptions & FIND_EXPIRED);
        mMessageType->setChecked(mOptions & FIND_MESSAGE);
        mFileType->setChecked(mOptions & FIND_FILE);
        mCommandType->setChecked(mOptions & FIND_COMMAND);
        mEmailType->setChecked(mOptions & FIND_EMAIL);

#ifndef MODAL_FIND
        connect(mDialog, SIGNAL(okClicked()), this, SLOT(slotFind()));
#endif
    }

    // Only display active/expired options if expired alarms are being kept
    if(noExpired)
    {
        mLive->hide();
        mExpired->hide();
        mActiveExpiredSep->hide();
    }
    else
    {
        mLive->show();
        mExpired->show();
        mActiveExpiredSep->show();
    }

    // Disable options where no displayed alarms match them
//.........这里部分代码省略.........
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:101,代码来源:find.cpp

示例3: QWidget


//.........这里部分代码省略.........
    //---

    // Buttons
    startButton = new QPushButton("Start");
    connect(startButton, SIGNAL(clicked()), this, SLOT(start_pause_resume()));
    connect(this, SIGNAL(startPushed()), mainWin, SLOT(startComputing()));
    connect(this, SIGNAL(pauseOrResumePushed(bool)), mainWin, SLOT(pauseComputing(bool)));
    stopButton = new QPushButton("Stop");
    stopButton->setEnabled(false);
    connect(stopButton, SIGNAL(clicked()), mainWin, SLOT(stopComputing()));
    connect(stopButton, SIGNAL(clicked()), this, SLOT(stop()));

    // Checkbox for saving option
    saveDirCheckBox = new QCheckBox("Save data");
    saveDirCheckBox->setChecked(false);

    // Button for QFileDialog
    saveDirButton = new QPushButton("Choose saving directory");
    connect(saveDirButton, SIGNAL(clicked()), this, SLOT(changeDirectory()));

    // Steps to skip Label
    QLabel *saveStepsLabel = new QLabel("Steps between saves :");

    // Steps to skip Spinbox
    saveStepsSpinBox = new QSpinBox();
    saveStepsSpinBox->setRange(1, 1000000);
    saveStepsSpinBox->setSingleStep(1);
    saveStepsSpinBox->setValue(defaultNbStepsToSave);
    connect(saveStepsSpinBox, SIGNAL(valueChanged(int)), mainWin, SLOT(changeNbStepsToSave(int)));

    //---

    // Labels and lists for variables to display
    QLabel *variablesRenderedLabel = new QLabel("Variables rendered :");
    variablesRenderedList = new QListWidget;
    variablesRenderedList->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored));
    variablesRenderedList->setMinimumSize(QSize(30,100)); //modify if needed (height = nItems * cst?)
    connect(variablesRenderedList, SIGNAL(itemChanged(QListWidgetItem *)), this, SLOT(updateRenderedVars(QListWidgetItem *)));

    // Rendering colormap label & dropdown list
    QLabel *colorLabel = new QLabel("Colormap :");
    QComboBox *colorComboBox = new QComboBox;
    std::map<std::string, std::pair<unsigned int, float*>> colormap = ColorMap::multiHueColorMaps();
    for (auto it = colormap.begin(); it != colormap.end(); ++it) {
        colorComboBox->addItem(QString(it->first.c_str()));
    }
    connect(colorComboBox, SIGNAL(currentIndexChanged(const QString &)), mainWin, SLOT(changeColormap(const QString &)));

    // Auto rendering checkbox
    QCheckBox *autoRenderCheckBox = new QCheckBox("Automatic rendering");
    autoRenderCheckBox->setChecked(true);
    connect(autoRenderCheckBox, SIGNAL(stateChanged(int)), mainWin, SLOT(changeAutoRendering(int)));
    connect(autoRenderCheckBox, SIGNAL(stateChanged(int)), this, SLOT(showSlider(int)));
    autoRenderCheckBox->setVisible(false);
    
    // Iteration selection slider
    gridSlider = new QSlider(Qt::Horizontal);
    gridSlider->setRange(1, 100); // to be updated when iterSpinBox changes value
    gridSlider->setPageStep(5);
    gridSlider->setSingleStep(1);
    gridSlider->setTracking(false);
    gridSlider->setValue(1);
    gridSlider->hide();
    connect(gridSlider, SIGNAL(valueChanged(int)), mainWin, SLOT(changeDisplayedGrid(int)));
    
    //----//

    // Add Widgets
    globalLayout->setSpacing(30);
    globalLayout->addWidget(modelGroupBox);
    globalLayout->addWidget(runGroupBox);
    globalLayout->addWidget(renderOptionsGroupBox);

    modelLayout->setSpacing(10);
    modelLayout->addWidget(modelLabel, 0, 0);
    modelLayout->addWidget(modelComboBox, 0, 1);
    modelLayout->addWidget(iterLabel, 1, 0);
    modelLayout->addWidget(iterSpinBox, 1, 1);
    modelLayout->addWidget(initButton, 2, 0);
    modelLayout->addWidget(paramsButton, 2, 1);

    runLayout->setSpacing(10);
    runLayout->addWidget(startButton, 0, 0, 1, 2);
    runLayout->addWidget(stopButton, 1, 0, 1, 2);
    runLayout->addWidget(saveDirCheckBox, 2, 0);
    runLayout->addWidget(saveDirButton, 2, 1);
    runLayout->addWidget(saveStepsLabel, 3, 0);
    runLayout->addWidget(saveStepsSpinBox, 3, 1);

    renderOptionsLayout->setSpacing(10);
    renderOptionsLayout->addWidget(variablesRenderedLabel, 0, 0);
    renderOptionsLayout->addWidget(variablesRenderedList, 0, 1);
    renderOptionsLayout->addWidget(colorLabel, 1, 0);
    renderOptionsLayout->addWidget(colorComboBox,1 , 1);
    renderOptionsLayout->addWidget(autoRenderCheckBox, 2, 0);
    renderOptionsLayout->addWidget(gridSlider, 2, 1);
    
    // Init m_argsMap and m_varsMap
    refreshParameters(modelComboBox->currentIndex());
}
开发者ID:Poulpy21,项目名称:Projet_Spe,代码行数:101,代码来源:sidePanel.cpp

示例4: QWidget

SeExprEdColorCurve::SeExprEdColorCurve(QWidget* parent, QString pLabel, QString vLabel, QString iLabel,
    bool expandable) :
    QWidget(parent),  _scene(0), _selPosEdit(0), _selValEdit(0), _interpComboBox(0)
{
    Q_UNUSED(iLabel);
    QHBoxLayout *mainLayout = new QHBoxLayout();
    mainLayout->setSpacing(2);
    mainLayout->setMargin(5);

    QWidget *edits = new QWidget;
    QVBoxLayout *editsLayout = new QVBoxLayout;
    editsLayout->setAlignment(Qt::AlignTop);
    editsLayout->setSpacing(0);
    editsLayout->setMargin(0);
    edits->setLayout(editsLayout);

    QWidget *selPos = new QWidget;
    QHBoxLayout *selPosLayout = new QHBoxLayout;
    selPosLayout->setSpacing(1);
    selPosLayout->setMargin(1);
    selPos->setLayout(selPosLayout);
    _selPosEdit = new QLineEdit;
    QDoubleValidator *posValidator = new QDoubleValidator(0.0,1.0,6,_selPosEdit);
    _selPosEdit->setValidator(posValidator);
    _selPosEdit->setFixedWidth(38);
    _selPosEdit->setFixedHeight(20);
    selPosLayout->addStretch(50);
    QLabel *posLabel;
    if (pLabel.isEmpty()) {
        posLabel = new QLabel("Selected Position:  ");
    } else {
        posLabel = new QLabel(pLabel);
    }
    selPosLayout->addWidget(posLabel);
    selPosLayout->addWidget(_selPosEdit);

    QWidget *selVal = new QWidget;
    QBoxLayout *selValLayout = new QHBoxLayout;
    selValLayout->setSpacing(1);
    selValLayout->setMargin(1);
    selVal->setLayout(selValLayout);
    _selValEdit = new SeExprEdCSwatchFrame(SeVec3d(.5));
    _selValEdit->setFixedWidth(38);
    _selValEdit->setFixedHeight(20);
    selValLayout->addStretch(50);
    QLabel *valLabel;
    if (vLabel.isEmpty()) {
        valLabel = new QLabel("Selected Color:  ");
    } else {
        valLabel = new QLabel(vLabel);
    }
    selValLayout->addWidget(valLabel);
    selValLayout->addWidget(_selValEdit);

    _interpComboBox = new QComboBox;
    _interpComboBox->addItem("None");
    _interpComboBox->addItem("Linear");
    _interpComboBox->addItem("Smooth");
    _interpComboBox->addItem("Spline");
    _interpComboBox->addItem("MSpline");
    _interpComboBox->setCurrentIndex(4);
    _interpComboBox->setFixedWidth(70);
    _interpComboBox->setFixedHeight(20);

    editsLayout->addWidget(selPos);
    editsLayout->addWidget(selVal);
    editsLayout->addWidget(_interpComboBox);

    QFrame *curveFrame = new QFrame;
    curveFrame->setFrameShape(QFrame::Panel);
    curveFrame->setFrameShadow(QFrame::Sunken);
    curveFrame->setLineWidth(1);
    QHBoxLayout *curveFrameLayout = new QHBoxLayout;
    curveFrameLayout->setMargin(0);
    CurveGraphicsView *curveView = new CurveGraphicsView;
    curveView->setFrameShape(QFrame::Panel);
    curveView->setFrameShadow(QFrame::Sunken);
    curveView->setLineWidth(1);
    curveView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    curveView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    _scene = new CCurveScene;
    curveView->setScene(_scene);
    curveView->setTransform(QTransform().scale(1, -1));
    curveView->setRenderHints(QPainter::Antialiasing);
    curveFrameLayout->addWidget(curveView);
    curveFrame->setLayout(curveFrameLayout);

    mainLayout->addWidget(edits);
    mainLayout->addWidget(curveFrame);
    if(expandable){
        QPushButton* expandButton=new QPushButton(">");
        expandButton->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding);
        expandButton->setFixedWidth(15);
        mainLayout->addWidget(expandButton);
        // open a the detail widget when clicked
        connect(expandButton, SIGNAL(clicked()), this, SLOT(openDetail()));
    }
    mainLayout->setStretchFactor(curveFrame,100);
    setLayout(mainLayout);

//.........这里部分代码省略.........
开发者ID:DINKIN,项目名称:SeExpr,代码行数:101,代码来源:SeExprEdColorCurve.cpp

示例5: QFrame

TupCanvas::TupCanvas(QWidget *parent, Qt::WindowFlags flags, TupGraphicsScene *scene, 
                   const QPointF centerPoint, const QSize &screenSize, TupProject *project, double scaleFactor,
                   int angle, TupBrushManager *brushManager) : QFrame(parent, flags), k(new Private)
{
    setWindowTitle(tr("Tupi: Open 2D Magic"));
    setWindowIcon(QIcon(QPixmap(THEME_DIR + "icons/animation_mode.png")));

    k->scene = scene;
    k->size = project->dimension();
    k->currentColor = brushManager->penColor();
    k->brushManager = brushManager;
    k->project = project;

    graphicsView = new TupCanvasView(this, screenSize, k->size, project->bgColor());

    graphicsView->setScene(scene);
    graphicsView->centerOn(centerPoint);
    graphicsView->scale(scaleFactor, scaleFactor);
    graphicsView->rotate(angle);

    TImageButton *pencil = new TImageButton(QPixmap(THEME_DIR + "icons/pencil_big.png"), 40, this, true);
    pencil->setToolTip(tr("Pencil"));
    connect(pencil, SIGNAL(clicked()), this, SLOT(wakeUpPencil()));

    TImageButton *ink = new TImageButton(QPixmap(THEME_DIR + "icons/ink_big.png"), 40, this, true);
    ink->setToolTip(tr("Ink"));
    connect(ink, SIGNAL(clicked()), this, SLOT(wakeUpInk()));

    /*
    TImageButton *polyline = new TImageButton(QPixmap(THEME_DIR + "icons/polyline_big.png"), 40, this, true);
    polyline->setToolTip(tr("Polyline"));
    connect(polyline, SIGNAL(clicked()), this, SLOT(wakeUpPolyline()));
    */

    TImageButton *ellipse = new TImageButton(QPixmap(THEME_DIR + "icons/ellipse_big.png"), 40, this, true);
    ellipse->setToolTip(tr("Ellipse"));
    connect(ellipse, SIGNAL(clicked()), this, SLOT(wakeUpEllipse()));

    TImageButton *rectangle = new TImageButton(QPixmap(THEME_DIR + "icons/square_big.png"), 40, this, true);
    rectangle->setToolTip(tr("Rectangle"));
    connect(rectangle, SIGNAL(clicked()), this, SLOT(wakeUpRectangle()));

    TImageButton *images = new TImageButton(QPixmap(THEME_DIR + "icons/bitmap_big.png"), 40, this, true);
    images->setToolTip(tr("Images"));
    connect(images, SIGNAL(clicked()), this, SLOT(wakeUpLibrary()));

    TImageButton *objects = new TImageButton(QPixmap(THEME_DIR + "icons/selection_big.png"), 40, this, true);
    objects->setToolTip(tr("Object Selection"));
    connect(objects, SIGNAL(clicked()), this, SLOT(wakeUpObjectSelection()));

    TImageButton *nodes = new TImageButton(QPixmap(THEME_DIR + "icons/nodes_big.png"), 40, this, true);
    nodes->setToolTip(tr("Line Selection"));
    connect(nodes, SIGNAL(clicked()), this, SLOT(wakeUpNodeSelection()));

    TImageButton *trash = new TImageButton(QPixmap(THEME_DIR + "icons/delete_big.png"), 40, this, true);
    trash->setToolTip(tr("Delete Selection"));
    connect(trash, SIGNAL(clicked()), this, SLOT(wakeUpDeleteSelection()));

    TImageButton *zoomIn = new TImageButton(QPixmap(THEME_DIR + "icons/zoom_in_big.png"), 40, this, true);
    zoomIn->setToolTip(tr("Zoom In"));
    connect(zoomIn, SIGNAL(clicked()), this, SLOT(wakeUpZoomIn()));

    TImageButton *zoomOut = new TImageButton(QPixmap(THEME_DIR + "icons/zoom_out_big.png"), 40, this, true);
    zoomOut->setToolTip(tr("Zoom Out"));
    connect(zoomOut, SIGNAL(clicked()), this, SLOT(wakeUpZoomOut()));

    TImageButton *hand = new TImageButton(QPixmap(THEME_DIR + "icons/hand_big.png"), 40, this, true);
    hand->setToolTip(tr("Hand"));
    connect(hand, SIGNAL(clicked()), this, SLOT(wakeUpHand()));

    TImageButton *undo = new TImageButton(QPixmap(THEME_DIR + "icons/undo_big.png"), 40, this, true);
    undo->setToolTip(tr("Undo"));
    connect(undo, SIGNAL(clicked()), this, SLOT(undo()));

    TImageButton *redo = new TImageButton(QPixmap(THEME_DIR + "icons/redo_big.png"), 40, this, true);
    redo->setToolTip(tr("Redo"));
    connect(redo, SIGNAL(clicked()), this, SLOT(redo()));

    TImageButton *colors = new TImageButton(QPixmap(THEME_DIR + "icons/color_palette_big.png"), 40, this, true);
    colors->setToolTip(tr("Color Palette"));
    connect(colors, SIGNAL(clicked()), this, SLOT(colorDialog()));

    TImageButton *pen = new TImageButton(QPixmap(THEME_DIR + "icons/pen_properties.png"), 40, this, true);
    pen->setToolTip(tr("Pen Size"));
    connect(pen, SIGNAL(clicked()), this, SLOT(penDialog()));

    TImageButton *exposure = new TImageButton(QPixmap(THEME_DIR + "icons/exposure_sheet_big.png"), 40, this, true);
    exposure->setToolTip(tr("Exposure Sheet"));
    connect(exposure, SIGNAL(clicked()), this, SLOT(exposureDialog()));

    QBoxLayout *controls = new QBoxLayout(QBoxLayout::TopToBottom);
    controls->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
    controls->setContentsMargins(3, 3, 3, 3);
    controls->setSpacing(7);

    controls->addWidget(pencil);
    controls->addWidget(ink);
    // controls->addWidget(polyline);
    controls->addWidget(ellipse);
    controls->addWidget(rectangle);
//.........这里部分代码省略.........
开发者ID:nanox,项目名称:tupi,代码行数:101,代码来源:tupcanvas.tablet.cpp

示例6: QLabel

FinderHomeWidget::FinderHomeWidget(QWidget *parent) : QWidget(parent) {

    setWindowTitle(tr("Home"));

    // speedup painting since we'll paint the whole background
    // by ourselves anyway in paintEvent()
    setAttribute(Qt::WA_OpaquePaintEvent);

    // colors
    QPalette p = palette();
    p.setBrush(QPalette::Base, Qt::black);
    p.setColor(QPalette::Text, QColor(Qt::white));
    p.setBrush(QPalette::Window, Qt::black);
    p.setColor(QPalette::WindowText, QColor(Qt::white));
    this->setPalette(p);

    QBoxLayout *layout = new QVBoxLayout(this);
    layout->setMargin(0);
    layout->setSpacing(0);
    layout->setAlignment(Qt::AlignLeft | Qt::AlignTop);

    QLabel *welcomeLabel =
            new QLabel("<h3>" +
                       tr("Welcome to <a href='%1'>%2</a>,")
                       .replace("<a ", "<a style='color:white'")
                       .arg(Constants::WEBSITE, Constants::APP_NAME)
                       + "</h3>" + tr("Use the icons below to explore your music collection."), this);
    welcomeLabel->setOpenExternalLinks(true);
    welcomeLabel->setMargin(15);
    layout->addWidget(welcomeLabel);
    // welcomeLabel->setStyleSheet("background: qlineargradient(x1:0, y1:0, x2:1, y2:1,stop:0 #1a1a1a, stop:1 #343434)");

    QListWidget *items = new QListWidget(this);
    connect(items, SIGNAL(itemActivated(QListWidgetItem*)), SLOT(itemActivated(QListWidgetItem*)));
    items->setAutoFillBackground(false);
    items->setAttribute(Qt::WA_NoSystemBackground);
    items->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
    items->setFrameShape(QFrame::NoFrame);
    items->setAttribute(Qt::WA_MacShowFocusRect, false);
    items->setSelectionMode(QAbstractItemView::NoSelection);

    items->addItem(tr("Artists"));
    items->addItem(tr("Albums"));
    items->addItem(tr("Tracks"));
    items->addItem(tr("Years"));
    items->addItem(tr("Languages"));

    layout->addWidget(items);

    /*
      Artists
      Albums
      Tracks
      Time machine
      By language
      Files
      ---
      Tagcloud
      */

}
开发者ID:PhillipMwaniki,项目名称:musique,代码行数:61,代码来源:finderhomewidget.cpp

示例7: QWidget

MainWindow::MainWindow()
    : QWidget(nullptr)
    , _newsReply(nullptr)
    , _informationWidget(nullptr)
    , _scenes(nullptr)
    , _shortcutWidget(nullptr)
    , _syncWidget(nullptr)
{
    setObjectName("MainWindow");
    setFixedSize(WindowSize);
    //setContentsMargins(0, 0, 0, 0);
    
    QGridLayout* layout = new QGridLayout;
    layout->setContentsMargins(0, 0, 0, 0);
    
    QLabel* image = new QLabel;
    //image->setContentsMargins(0, 0, 0, 0);
    image->setObjectName("Image");
    QPixmap p = QPixmap(":/images/header.png");
    image->setPixmap(p.scaledToWidth(WindowSize.width()));
    layout->addWidget(image, 0, 0, 1, 2);

    
    _informationWidget = new QTextEdit(this);
    _informationWidget->setReadOnly(true);
    _informationWidget->setEnabled(false);
    layout->addWidget(_informationWidget, 1, 0, 2, 1);
    layout->setRowStretch(1, 10);
    layout->setColumnStretch(0, 4);
    layout->setColumnStretch(1, 5);

    QWidget* container = new QWidget;
    {
        QGridLayout* innerLayout = new QGridLayout;
        
        QLabel* shortcutLabel = new QLabel("Keyboard Shortcuts:");
        innerLayout->addWidget(shortcutLabel, 0, 0);
        QPushButton* shortcutButton = new QPushButton("Open...");
        QObject::connect(shortcutButton, SIGNAL(clicked(bool)),
                         this, SLOT(shortcutButtonPressed())
                         );
        innerLayout->addWidget(shortcutButton, 0, 1);

        innerLayout->setRowStretch(1, 10);

        QLabel* configurationSelectionLabel = new QLabel("Configuration:");
        innerLayout->addWidget(configurationSelectionLabel, 2, 0);
        _configurations = new QComboBox;
        innerLayout->addWidget(_configurations, 2, 1);
        
        QLabel* sceneSelectionLabel = new QLabel("Scenes:");
        innerLayout->addWidget(sceneSelectionLabel, 3, 0);
        _scenes = new QComboBox;
        innerLayout->addWidget(_scenes, 3, 1);
        
        container->setLayout(innerLayout);
    }
    layout->addWidget(container, 1, 1);
    
    container = new QWidget;
    {
        QBoxLayout* innerLayout = new QHBoxLayout;
        
        QPushButton* cancelButton = new QPushButton("Cancel");
        QObject::connect(
            cancelButton, SIGNAL(clicked(bool)),
            QApplication::instance(), SLOT(quit())
        );
        innerLayout->addWidget(cancelButton);
        
        QPushButton* syncButton = new QPushButton("Sync");
        QObject::connect(
            syncButton, SIGNAL(clicked(bool)),
            this, SLOT(syncButtonPressed())
        );
        innerLayout->addWidget(syncButton);
        
        QPushButton* startButton = new QPushButton("Start");
        QObject::connect(
            startButton, SIGNAL(clicked(bool)),
            this, SLOT(startButtonPressed())
        );
        innerLayout->addWidget(startButton);
        
        container->setLayout(innerLayout);
    }
    layout->addWidget(container, 2, 1);
    
    setLayout(layout);
    
    initialize();
}
开发者ID:OpenSpace,项目名称:OpenSpace,代码行数:92,代码来源:mainwindow.cpp

示例8: name

//
// Constructor
//                                                                  
MsgDialog::MsgDialog(QWidget *parent, const char *name, QStringList &list)
// : QDialog(parent, name)
 : QWidget(parent, name)
{
#ifdef DEBUGMSG
  qDebug("MsgDialog() '%s' List passed by ref with %d elements", 
       name, list.count());
#endif

   m_bScrollLock = FALSE;
   m_nButtons = 0;
   m_nIndent = 5;   // num of spaces to indent wrapped lines
   m_nLockIndex = 0;
   m_nIndex = 0;
   m_bUseIndexing = FALSE;
   m_bShowType = TRUE;
   m_nShown = 0;
   m_nEditItem = -1;
   m_bAdditiveFilter = FALSE;

#if 0
   m_pMsgTypeCheckBox = 0;
   m_pButtonsPanel = 0;
   m_pEdit = 0;
   m_pStatusBar = 0;
   m_pStatusBarLock = 0;
   m_pStatusBarMsgcount = 0;
   m_pStatusBarTotMsgcount = 0;
   m_pStatusBarFilter = 0;
   m_pButtonsLayout = 0;
   m_pMenu = 0;
   m_pStringList = 0;
#endif

//  Anyone want to explain to me why ShowEQ segfaults upon exit when I
//  uncomment out the following line.  This baffles me.... it acts like 
//  it causes something to get destroyed when it's not supposed to be
//     - Maerlyn
//   m_pButtonOver = 0;

   // use the shared list given to us
   m_pStringList = &list;

   // set Title
   setCaption(QString(name));

   // install event filter to catch right clicks to add buttons 
   installEventFilter(this);
   
   // top-level layout; a vertical box to contain all widgets and sublayouts
   QBoxLayout *topLayout = new QVBoxLayout(this);
  
   // Make an hbox that will hold the textbox and the row of filterbuttons
   QBoxLayout *middleLayout = new QHBoxLayout(topLayout);
  
   // add the edit
//   m_pEdit = new QMultiLineEdit(this, "edit"); 
   m_pEdit = new MyEdit(this, "edit"); 
   m_pEdit->setFrameStyle(QFrame::Panel | QFrame::Sunken);
   m_pEdit->setReadOnly(TRUE);
   m_pEdit->setFont(QFont("Helvetica", 10));
   middleLayout->addWidget(m_pEdit);
  
   // add a vertical box to hold the button layout and the stretch 
   QBoxLayout *rightLayout = new QVBoxLayout(middleLayout);
  
   // add a vertical box to hold the filter buttons
   m_pButtonsPanel = new QWidget(this, "buttonPanel");
   rightLayout->addWidget(m_pButtonsPanel);
   m_pButtonsLayout = new QVBoxLayout(m_pButtonsPanel);
  
   // Make an hbox that will hold the tools 
   QBoxLayout *tools = new QHBoxLayout(m_pButtonsLayout);

   // Make an bbox that will hold the right tools 
   QBoxLayout *righttools = new QVBoxLayout(tools);

   // Add an 'additive' vs 'subtractive checkbox
   m_pAdditiveCheckBox = new QCheckBox("Additive", m_pButtonsPanel);
   m_pAdditiveCheckBox->setChecked(isAdditive());
   connect(m_pAdditiveCheckBox, SIGNAL (toggled(bool)), 
                this, SLOT (setAdditive(bool)));
   righttools->addWidget(m_pAdditiveCheckBox);
  
   // Add a 'scroll-lock' checkbox
   QCheckBox *pScrollLockCheckBox= new QCheckBox("Lock", m_pButtonsPanel);
   pScrollLockCheckBox->setChecked(FALSE);
   connect(pScrollLockCheckBox, SIGNAL (toggled(bool)),
                this, SLOT (scrollLock(bool)));
   righttools->addWidget(pScrollLockCheckBox);

   // Add a 'msg type' checkbox
   m_pMsgTypeCheckBox = new QCheckBox("Msg Type", m_pButtonsPanel);
   m_pMsgTypeCheckBox->setChecked(m_bShowType);
   connect(m_pMsgTypeCheckBox, SIGNAL (toggled(bool)),
                this, SLOT (showMsgType(bool)));
   righttools->addWidget(m_pMsgTypeCheckBox);
//.........这里部分代码省略.........
开发者ID:xbackupx,项目名称:showeqx,代码行数:101,代码来源:msgdlg.cpp

示例9: QWidget

GDBOutputWidget::GDBOutputWidget(CppDebuggerPlugin* plugin, QWidget *parent) :
    QWidget(parent),
    m_userGDBCmdEditor(0),
    m_Interrupt(0),
    m_gdbView(0),
    showInternalCommands_(false),
    maxLines_(5000)
{
//     setWindowIcon(KIcon("inline_image"));
    setWindowIcon(KIcon("debugger"));
    setWindowTitle(i18n("GDB Output"));
    setWhatsThis(i18n("<b>GDB output</b><p>"
                    "Shows all gdb commands being executed. "
                    "You can also issue any other gdb command while debugging.</p>"));

    m_gdbView = new OutputTextEdit(this);
    m_gdbView->setReadOnly(true);

    m_userGDBCmdEditor = new KHistoryComboBox (this);

    QLabel *label = new QLabel(i18n("&GDB cmd:"), this);
    label->setBuddy(m_userGDBCmdEditor);

    m_Interrupt = new QToolButton( this );
    m_Interrupt->setIcon ( KIcon ( "media-playback-pause" ) );
    m_Interrupt->setToolTip( i18n ( "Pause execution of the app to enter gdb commands" ) );

    QVBoxLayout *topLayout = new QVBoxLayout(this);
    topLayout->addWidget(m_gdbView);
    topLayout->setStretchFactor(m_gdbView, 1);
    topLayout->setMargin(0);

    QBoxLayout *userGDBCmdEntry = new QHBoxLayout();
    userGDBCmdEntry->addWidget(label);
    userGDBCmdEntry->addWidget(m_userGDBCmdEditor);
    userGDBCmdEntry->setStretchFactor(m_userGDBCmdEditor, 1);
    userGDBCmdEntry->addWidget(m_Interrupt);
    topLayout->addLayout(userGDBCmdEntry);

    setLayout(topLayout);

    slotStateChanged(s_none, s_dbgNotStarted);

    connect( m_userGDBCmdEditor, SIGNAL(returnPressed()), SLOT(slotGDBCmd()) );
    connect( m_Interrupt,        SIGNAL(clicked()),       SIGNAL(breakInto()));

    updateTimer_.setSingleShot(true);
    connect( &updateTimer_, SIGNAL(timeout()),
             this,  SLOT(flushPending()));

    connect(KDevelop::ICore::self()->debugController(), 
            SIGNAL(currentSessionChanged(KDevelop::IDebugSession*)),
            SLOT(currentSessionChanged(KDevelop::IDebugSession*)));

    connect(plugin, SIGNAL(reset()), this, SLOT(clear()));
    connect(plugin, SIGNAL(raiseGdbConsoleViews()), SIGNAL(requestRaise()));

    currentSessionChanged(KDevelop::ICore::self()->debugController()->currentSession());

    connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()),
            this, SLOT(updateColors()));
    updateColors();

}
开发者ID:krf,项目名称:kdevelop,代码行数:64,代码来源:gdboutputwidget.cpp

示例10: setupPage

void KDMSessionsWidget::setupPage(QWidget *)
{
      QGroupBox *group0 = new QGroupBox( i18n("Allow to shutdown"), this );

      sdcombo = new QComboBox( FALSE, group0 );
      connect(sdcombo, SIGNAL(highlighted(int)), SLOT(slotSetAllowShutdown(int)));
      sdcombo->insertItem(klocale->translate("None"), 0);
      sdcombo->insertItem(klocale->translate("All"), 1);
      sdcombo->insertItem(klocale->translate("Root Only"), 2);
      sdcombo->insertItem(klocale->translate("Console Only"), 3);
      sdcombo->setCurrentItem(sdMode);
      sdcombo->setFixedSize(sdcombo->sizeHint());

      QGroupBox *group1 = new QGroupBox( klocale->translate("Commands"), this );
      QLabel *shutdown_label = new QLabel(klocale->translate("Shutdown"), group1);
      shutdown_label->setFixedSize(shutdown_label->sizeHint());
      shutdown_lined = new QLineEdit(group1);
      shutdown_lined->setFixedHeight(shutdown_lined->sizeHint().height());
      shutdown_lined->setText(shutdownstr);

      QLabel *restart_label = new QLabel(klocale->translate("Restart"), group1);
      restart_label->setFixedSize(restart_label->sizeHint());

      restart_lined = new QLineEdit(group1);
      restart_lined->setFixedHeight(shutdown_lined->height());
      restart_lined->setText(restartstr);

      QGroupBox *group2 = new QGroupBox( klocale->translate("Session types"), this );
      
      QLabel *type_label = new QLabel(klocale->translate("New type"), group2);
      type_label->setFixedSize(type_label->sizeHint());

      session_lined = new QLineEdit(group2);
      session_lined->setFixedHeight(session_lined->sizeHint().height());
      connect(session_lined, SIGNAL(textChanged(const char*)),
              SLOT(slotCheckNewSession(const char*)));
      connect(session_lined, SIGNAL(returnPressed()),
              SLOT(slotAddSessionType()));

      QLabel *types_label = new QLabel(klocale->translate("Available types"), group2);
      types_label->setFixedSize(types_label->sizeHint());

      sessionslb = new MyListBox(group2);
      connect(sessionslb, SIGNAL(highlighted(int)), SLOT(slotSessionHighlighted(int)));
      sessionslb->insertStrList(&sessions);

      btnrm = new QPushButton( klocale->translate("Remove"), group2 );
      btnrm->setFixedSize(btnrm->sizeHint());
      btnrm->setEnabled(false);
      connect( btnrm, SIGNAL( clicked() ), SLOT( slotRemoveSessionType() ) );

      btnadd = new QPushButton( klocale->translate("Add"), group2 );
      btnadd->setFixedSize(btnadd->sizeHint());
      btnadd->setEnabled(false);
      connect( btnadd, SIGNAL( clicked() ), SLOT( slotAddSessionType() ) );

      btnup = new KDirectionButton(UpArrow, group2);
      btnup->setFixedSize(20, 20);
      btnup->setEnabled(false);
      connect(btnup, SIGNAL( clicked() ), SLOT( slotSessionUp() ));
      btndown = new KDirectionButton(DownArrow, group2);
      btndown->setFixedSize(20, 20);
      btndown->setEnabled(false);
      connect(btndown,SIGNAL( clicked() ), SLOT( slotSessionDown() ));

      QBoxLayout *main = new QVBoxLayout( this, 10 );
      QBoxLayout *lgroup0 = new QVBoxLayout( group0, 10 );

      QBoxLayout *lgroup1 = new QVBoxLayout( group1, 10 );
      QBoxLayout *lgroup1a = new QHBoxLayout();
      QBoxLayout *lgroup1b = new QHBoxLayout();

      QBoxLayout *lgroup2 = new QVBoxLayout( group2, 10 );
      QBoxLayout *lgroup2sub = new QHBoxLayout();
      QBoxLayout *lgroup2a = new QVBoxLayout();
      QBoxLayout *lgroup2b = new QVBoxLayout();
      QBoxLayout *lgroup2c = new QVBoxLayout();

      main->addWidget(group0);
      main->addWidget(group1);
      main->addWidget(group2, 2);

      lgroup0->addSpacing(10);
      lgroup0->addWidget(sdcombo);

      lgroup1->addSpacing(group1->fontMetrics().height()/2);
      lgroup1->addLayout(lgroup1a);
      lgroup1->addLayout(lgroup1b);
      lgroup1a->addWidget(shutdown_label);
      lgroup1a->addWidget(shutdown_lined);

      lgroup1b->addWidget(restart_label);
      lgroup1b->addWidget(restart_lined);
      lgroup1->activate();

      lgroup2->addSpacing(group2->fontMetrics().height()/2);
      lgroup2->addLayout(lgroup2sub);
      lgroup2sub->addLayout(lgroup2a, 2);
      lgroup2sub->addLayout(lgroup2b, 2);
      lgroup2sub->addLayout(lgroup2c);
//.........这里部分代码省略.........
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:101,代码来源:kdm-sess.cpp

示例11: QWidget

ExampleWidget::ExampleWidget( QWidget *parent, const char *name )
    : QWidget( parent, name )
{
    // Make the top-level layout; a vertical box to contain all widgets
    // and sub-layouts.
    QBoxLayout *topLayout = new QVBoxLayout( this, 5 );

    // Create a menubar...
    QMenuBar *menubar = new QMenuBar( this );
    menubar->setSeparator( QMenuBar::InWindowsStyle );
    QPopupMenu* popup;
    popup = new QPopupMenu( this );
    popup->insertItem( "&Quit", qApp, SLOT(quit()) );
    menubar->insertItem( "&File", popup );

    // ...and tell the layout about it.
    topLayout->setMenuBar( menubar );

    // Make an hbox that will hold a row of buttons.
    QBoxLayout *buttons = new QHBoxLayout( topLayout );
    int i;
    for ( i = 1; i <= 4; i++ ) {
	QPushButton* but = new QPushButton( this );
	QString s;
	s.sprintf( "Button %d", i );
	but->setText( s );

	// Set horizontal stretch factor to 10 to let the buttons
	// stretch horizontally. The buttons will not stretch
	// vertically, since bigWidget below will take up vertical
	// stretch.
	buttons->addWidget( but, 10 );
	// (Actually, the result would have been the same with a
	// stretch factor of 0; if no items in a layout have non-zero
	// stretch, the space is divided equally between members.)
    }

    // Make another hbox that will hold a left-justified row of buttons.
    QBoxLayout *buttons2 = new QHBoxLayout( topLayout );

    QPushButton* but = new QPushButton( "Button five", this );
    buttons2->addWidget( but );

    but = new QPushButton( "Button 6", this );
    buttons2->addWidget( but );

    // Fill up the rest of the hbox with stretchable space, so that
    // the buttons get their minimum width and are pushed to the left.
    buttons2->addStretch( 10 );

    // Make  a big widget that will grab all space in the middle.
    QMultiLineEdit *bigWidget = new QMultiLineEdit( this );
    bigWidget->setText( "This widget will get all the remaining space" );
    bigWidget->setFrameStyle( QFrame::Panel | QFrame::Plain );

    // Set vertical stretch factor to 10 to let the bigWidget stretch
    // vertically. It will stretch horizontally because there are no
    // widgets beside it to take up horizontal stretch.
    //    topLayout->addWidget( bigWidget, 10 );
    topLayout->addWidget( bigWidget ); 

    // Make a grid that will hold a vertical table of QLabel/QLineEdit
    // pairs next to a large QMultiLineEdit.

    // Don't use hard-coded row/column numbers in QGridLayout, you'll
    // regret it when you have to change the layout.
    const int numRows = 3;
    const int labelCol = 0;
    const int linedCol = 1;
    const int multiCol = 2;

    // Let the grid-layout have a spacing of 10 pixels between
    // widgets, overriding the default from topLayout.
    QGridLayout *grid = new QGridLayout( topLayout, 0, 0, 10 );
    int row;

    for ( row = 0; row < numRows; row++ ) {
	QLineEdit *ed = new QLineEdit( this );
	// The line edit goes in the second column
	grid->addWidget( ed, row, linedCol );	

	// Make a label that is a buddy of the line edit
	QString s;
	s.sprintf( "Line &%d", row+1 );
	QLabel *label = new QLabel( ed, s, this );
	// The label goes in the first column.
	grid->addWidget( label, row, labelCol );
    }

    // The multiline edit will cover the entire vertical range of the
    // grid (rows 0 to numRows) and stay in column 2.

    QMultiLineEdit *med = new QMultiLineEdit( this );
    grid->addMultiCellWidget( med, 0, -1, multiCol, multiCol );

    // The labels will take the space they need. Let the remaining
    // horizontal space be shared so that the multiline edit gets
    // twice as much as the line edit.
    grid->setColStretch( linedCol, 10 );
    grid->setColStretch( multiCol, 20 );
//.........这里部分代码省略.........
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:101,代码来源:layout.cpp

示例12: cg

RepositoryDialog::RepositoryDialog(KConfig& cfg, OrgKdeCervisia5CvsserviceCvsserviceInterface* cvsService,
                                   const QString& cvsServiceInterfaceName, QWidget* parent)
    : QDialog(parent)
    , m_partConfig(cfg)
    , m_cvsService(cvsService)
    , m_cvsServiceInterfaceName(cvsServiceInterfaceName)
{
    setWindowTitle(i18n("Configure Access to Repositories"));
    setModal(true);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    setLayout(mainLayout);

    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help);
    QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
    okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
    connect(okButton, SIGNAL(clicked()), this, SLOT(slotOk()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    QBoxLayout* hbox = new QHBoxLayout;
    hbox->setMargin(0);
    mainLayout->addLayout(hbox);

    m_repoList = new QTreeWidget;
    hbox->addWidget(m_repoList, 10);
    m_repoList->setMinimumWidth(fontMetrics().width('0') * 60);
    m_repoList->setAllColumnsShowFocus(true);
    m_repoList->setRootIsDecorated(false);
    m_repoList->setHeaderLabels(QStringList() << i18n("Repository") << i18n("Method")
                                              << i18n("Compression") << i18n("Status"));
    m_repoList->setFocus();

    connect(m_repoList, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)),
            this, SLOT(slotDoubleClicked(QTreeWidgetItem*, int)));
    connect(m_repoList, SIGNAL(itemSelectionChanged()),
            this,       SLOT(slotSelectionChanged()));

    QDialogButtonBox* actionbox = new QDialogButtonBox(Qt::Vertical);
    QPushButton* addbutton = actionbox->addButton(i18n("Add..."), QDialogButtonBox::ActionRole);
    m_modifyButton = actionbox->addButton(i18n("Modify..."), QDialogButtonBox::ActionRole);
    m_removeButton = actionbox->addButton(i18n("Remove"), QDialogButtonBox::ActionRole);
    m_loginButton  = actionbox->addButton(i18n("Login..."), QDialogButtonBox::ActionRole);
    m_logoutButton = actionbox->addButton(i18n("Logout"), QDialogButtonBox::ActionRole);
    hbox->addWidget(actionbox, 0);

    m_loginButton->setEnabled(false);
    m_logoutButton->setEnabled(false);

    connect( addbutton, SIGNAL(clicked()),
             this, SLOT(slotAddClicked()) );
    connect( m_modifyButton, SIGNAL(clicked()),
             this, SLOT(slotModifyClicked()) );
    connect( m_removeButton, SIGNAL(clicked()),
             this, SLOT(slotRemoveClicked()) );
    connect( m_loginButton, SIGNAL(clicked()),
             this, SLOT(slotLoginClicked()) );
    connect( m_logoutButton, SIGNAL(clicked()),
             this, SLOT(slotLogoutClicked()) );

    // open cvs DBUS service configuration file
    m_serviceConfig = new KConfig("cvsservicerc");

    readCvsPassFile();
    readConfigFile();

    if (QTreeWidgetItem *item = m_repoList->topLevelItem(0))
    {
        m_repoList->setCurrentItem(item);
        item->setSelected(true);
    }
    else
    {
        // we have no item so disable modify and remove button
        slotSelectionChanged();
    }

    connect(buttonBox, &QDialogButtonBox::helpRequested, this, &RepositoryDialog::slotHelp);

    setAttribute(Qt::WA_DeleteOnClose, true);

    KConfigGroup cg(&m_partConfig, "RepositoryDialog");
    restoreGeometry(cg.readEntry<QByteArray>("geometry", QByteArray()));

    QByteArray state = cg.readEntry<QByteArray>("RepositoryListView", QByteArray());
    m_repoList->header()->restoreState(state);

    mainLayout->addWidget(buttonBox);
}
开发者ID:KDE,项目名称:cervisia,代码行数:88,代码来源:repositorydialog.cpp

示例13: addWidgets

void MainWindow::addWidgets()
{
    Q_D(MainWindow);

    int i = 0;

    d->mainContainer = new QWidget(this);

    // Selectors and file chooser
    d->deviceSel = new QComboBox(d->mainContainer);
    d->instLocSel = new QComboBox(d->mainContainer);
    d->instLocDesc = new QLabel(d->mainContainer);

    // Labels
    d->deviceLbl = new QLabel(tr("Device:"), d->mainContainer);
    d->instLocLbl = new QLabel(tr("Install to:"), d->mainContainer);

    // Text boxes
    d->instLocLe = new QLineEdit(d->mainContainer);
    d->instLocLe->setPlaceholderText(tr("Enter an ID"));
    QRegExp re(QStringLiteral("[a-z0-9]+"));
    QValidator *validator = new QRegExpValidator(re, this);
    d->instLocLe->setValidator(validator);

    QGridLayout *layout = new QGridLayout(d->mainContainer);
    layout->setContentsMargins(0, 0, 0, 0);
    layout->addWidget(d->deviceLbl, i, 0);
    layout->addWidget(d->deviceSel, i, 1, 1, -1);
    layout->addWidget(d->instLocLbl, ++i, 0);
    layout->addWidget(d->instLocSel, i, 1, 1, -1);
    layout->addWidget(d->instLocLe, ++i, 1, 1, -1);
    layout->addWidget(d->instLocDesc, ++i, 1, 1, -1);

    d->messageLbl = new QLabel(d->mainContainer);
    // Don't allow the window to grow too big
    d->messageLbl->setWordWrap(true);
    d->messageLbl->setMaximumWidth(550);

    d->chooseFileBtn = new QPushButton(tr("Choose file"), d->mainContainer);
    d->chooseAnotherFileBtn = new QPushButton(tr("Choose another file"), d->mainContainer);
    d->startPatchingBtn = new QPushButton(tr("Start patching"), d->mainContainer);

    d->buttons = new QDialogButtonBox(d->mainContainer);
    d->buttons->addButton(d->chooseFileBtn, QDialogButtonBox::ActionRole);
    d->buttons->addButton(d->chooseAnotherFileBtn, QDialogButtonBox::ActionRole);
    d->buttons->addButton(d->startPatchingBtn, QDialogButtonBox::ActionRole);

    QWidget *horiz1 = newHorizLine(d->mainContainer);

    layout->setColumnStretch(0, 0);
    layout->setColumnStretch(1, 0);
    layout->setColumnStretch(2, 0);
    layout->setColumnStretch(3, 1);

    layout->addWidget(horiz1,             ++i, 0, 1, -1);
    layout->addWidget(d->messageLbl,      ++i, 0, 1, -1);

    layout->addWidget(newHorizLine(d->mainContainer), ++i, 0, 1, -1);

    layout->addWidget(d->buttons,         ++i, 0, 1, -1);


    d->mainContainer->setLayout(layout);

    // List of widgets related to the message label
    d->messageWidgets << horiz1;
    d->messageWidgets << d->messageLbl;

    // Buttons
    d->progressContainer = new QWidget(this);
    QBoxLayout *progressLayout = new QVBoxLayout(d->progressContainer);
    progressLayout->setContentsMargins(0, 0, 0, 0);

    QGroupBox *detailsBox = new QGroupBox(d->progressContainer);
    detailsBox->setTitle(tr("Details"));

    d->detailsLbl = new QLabel(detailsBox);
    d->detailsLbl->setWordWrap(true);
    // Make sure the window doesn't change size while patching
    d->detailsLbl->setFixedWidth(500);

    QVBoxLayout *detailsLayout = new QVBoxLayout(detailsBox);
    detailsLayout->addWidget(d->detailsLbl);
    detailsBox->setLayout(detailsLayout);

    d->progressBar = new QProgressBar(d->progressContainer);
    //d->progressBar->setFormat(tr("%p% - %v / %m files"));
    d->progressBar->setMaximum(0);
    d->progressBar->setMinimum(0);
    d->progressBar->setValue(0);

    progressLayout->addWidget(detailsBox);
    //progressLayout->addStretch(1);
    progressLayout->addWidget(newHorizLine(d->progressContainer));
    progressLayout->addWidget(d->progressBar);
    d->progressContainer->setLayout(progressLayout);


    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    mainLayout->setSizeConstraint(QLayout::SetFixedSize);
//.........这里部分代码省略.........
开发者ID:SerenityS,项目名称:DualBootPatcher,代码行数:101,代码来源:mainwindow.cpp

示例14: QWidget

KDMGeneralWidget::KDMGeneralWidget( QWidget *parent )
	: QWidget( parent )
{
	QString wtstr;

	QBoxLayout *ml = new QVBoxLayout( this );
	ml->setSpacing( KDialog::spacingHint() );
	ml->setMargin( KDialog::marginHint() );

	QGroupBox *box = new QGroupBox( "Appearance", this );
	ml->addWidget( box );
	QGridLayout *grid = new QGridLayout( box );
	grid->setSpacing( KDialog::spacingHint() );
	grid->setMargin( KDialog::marginHint() );
	grid->setColStretch( 2, 1 );

	useThemeCheck = new QCheckBox( i18n("&Use themed greeter"), box );
	connect( useThemeCheck, SIGNAL(toggled( bool )), SLOT(slotUseThemeChanged()) );
	useThemeCheck->setWhatsThis( i18n("Enable this if you would like to use a themed Login Manager.") );
	grid->addWidget( useThemeCheck, 0, 0, 1, 2 );

	guicombo = new KBackedComboBox( box );
	guicombo->insertItem( "", i18n("<placeholder>default</placeholder>") );
	loadGuiStyles( guicombo );
	QLabel *label = new QLabel( i18n("GUI s&tyle:"), box );
	label->setBuddy( guicombo );
	connect( guicombo, SIGNAL(activated( int )), SIGNAL(changed()) );
	grid->addWidget( label, 1, 0 );
	grid->addWidget( guicombo, 1, 1 );
	wtstr = i18n("You can choose a basic GUI style here that will be "
	             "used by KDM only.");
	label->setWhatsThis( wtstr );
	guicombo->setWhatsThis( wtstr );

	colcombo = new KBackedComboBox( box );
	colcombo->insertItem( "", i18n("<placeholder>default</placeholder>") );
	loadColorSchemes( colcombo );
	label = new QLabel( i18n("Color sche&me:"), box );
	label->setBuddy( colcombo );
	connect( colcombo, SIGNAL(activated( int )), SIGNAL(changed()) );
	grid->addWidget( label, 2, 0 );
	grid->addWidget( colcombo, 2, 1 );
	wtstr = i18n("You can choose a basic Color Scheme here that will be "
	             "used by KDM only.");
	label->setWhatsThis( wtstr );
	colcombo->setWhatsThis( wtstr );

	box = new QGroupBox( "Locale", this );
	ml->addWidget( box );
	grid = new QGridLayout( box );
	grid->setSpacing( KDialog::spacingHint() );
	grid->setMargin( KDialog::marginHint() );
	grid->setColStretch( 2, 1 );

	// The Language group box
	langcombo = new KLanguageButton( box );
	langcombo->showLanguageCodes(true);
	langcombo->loadAllLanguages();
	connect( langcombo, SIGNAL(activated( const QString & )), SIGNAL(changed()) );
	label = new QLabel( i18n("&Language:"), this );
	label->setBuddy( langcombo );
	grid->addWidget( label, 0, 0 );
	grid->addWidget( langcombo, 0, 1 );
	wtstr = i18n("Here you can choose the language used by KDM. This setting does not affect"
	             " a user's personal settings; that will take effect after login.");
	label->setWhatsThis( wtstr );
	langcombo->setWhatsThis( wtstr );

	box = new QGroupBox( "Fonts", this );
	ml->addWidget( box );
	grid = new QGridLayout( box );
	grid->setSpacing( KDialog::spacingHint() );
	grid->setMargin( KDialog::marginHint() );

	label = new QLabel( i18n("&General:"), box );
	stdFontChooser = new KFontRequester( box );
	label->setBuddy( stdFontChooser );
	stdFontChooser->setWhatsThis( i18n("This changes the font which is used for all the text in the login manager except for the greeting and failure messages.") );
	connect( stdFontChooser, SIGNAL(fontSelected( const QFont& )), SIGNAL(changed()) );
	grid->addWidget( label, 0, 0 );
	grid->addWidget( stdFontChooser, 0, 1 );

	label = new QLabel( i18n("&Failure font:"), box );
	failFontChooser = new KFontRequester( box );
	label->setBuddy( failFontChooser );
	failFontChooser->setWhatsThis( i18n("This changes the font which is used for failure messages in the login manager.") );
	connect( failFontChooser, SIGNAL(fontSelected( const QFont& )), SIGNAL(changed()) );
	grid->addWidget( label, 1, 0 );
	grid->addWidget( failFontChooser, 1, 1 );

	label = new QLabel( i18n("Gree&ting:"), box );
	greetingFontChooser = new KFontRequester( box );
	label->setBuddy( greetingFontChooser );
	greetingFontChooser->setWhatsThis( i18n("This changes the font which is used for the login manager's greeting.") );
	connect( greetingFontChooser, SIGNAL(fontSelected( const QFont& )), SIGNAL(changed()) );
	grid->addWidget( label, 2, 0 );
	grid->addWidget( greetingFontChooser, 2, 1 );

	aacb = new QCheckBox( i18n("Use anti-aliasing for fonts"), box );
	aacb->setWhatsThis( i18n("If you check this box and your X-Server has the Xft extension, "
//.........这里部分代码省略.........
开发者ID:jschwartzenberg,项目名称:kicker,代码行数:101,代码来源:kdm-gen.cpp

示例15: QWidget

DistributionListEditorWidget::DistributionListEditorWidget(AddressBook *addressBook, QWidget *parent) : QWidget(parent), mAddressBook(addressBook)
{
    kdDebug(5700) << "DistributionListEditor()" << endl;

    QBoxLayout *topLayout = new QVBoxLayout(this);
    topLayout->setSpacing(KDialog::spacingHint());

    QBoxLayout *nameLayout = new QHBoxLayout(topLayout);

    mNameCombo = new QComboBox(this);
    nameLayout->addWidget(mNameCombo);
    connect(mNameCombo, SIGNAL(activated(int)), SLOT(updateEntryView()));

    mNewButton = new QPushButton(i18n("New List..."), this);
    nameLayout->addWidget(mNewButton);
    connect(mNewButton, SIGNAL(clicked()), SLOT(newList()));

    mEditButton = new QPushButton(i18n("Rename List..."), this);
    nameLayout->addWidget(mEditButton);
    connect(mEditButton, SIGNAL(clicked()), SLOT(editList()));

    mRemoveButton = new QPushButton(i18n("Remove List"), this);
    nameLayout->addWidget(mRemoveButton);
    connect(mRemoveButton, SIGNAL(clicked()), SLOT(removeList()));

    QGridLayout *gridLayout = new QGridLayout(topLayout, 3, 3);
    gridLayout->setColStretch(1, 1);

    QLabel *listLabel = new QLabel(i18n("Available addresses:"), this);
    gridLayout->addWidget(listLabel, 0, 0);

    mListLabel = new QLabel(this);
    gridLayout->addMultiCellWidget(mListLabel, 0, 0, 1, 2);

    mAddresseeView = new QListView(this);
    mAddresseeView->addColumn(i18n("Name"));
    mAddresseeView->addColumn(i18n("Preferred Email"));
    mAddresseeView->setAllColumnsShowFocus(true);
    gridLayout->addWidget(mAddresseeView, 1, 0);
    connect(mAddresseeView, SIGNAL(selectionChanged()), SLOT(slotSelectionAddresseeViewChanged()));
    connect(mAddresseeView, SIGNAL(doubleClicked(QListViewItem *)), SLOT(addEntry()));

    mAddEntryButton = new QPushButton(i18n("Add Entry"), this);
    mAddEntryButton->setEnabled(false);
    gridLayout->addWidget(mAddEntryButton, 2, 0);
    connect(mAddEntryButton, SIGNAL(clicked()), SLOT(addEntry()));

    mEntryView = new QListView(this);
    mEntryView->addColumn(i18n("Name"));
    mEntryView->addColumn(i18n("Email"));
    mEntryView->addColumn(i18n("Use Preferred"));
    mEntryView->setEnabled(false);
    mEntryView->setAllColumnsShowFocus(true);
    gridLayout->addMultiCellWidget(mEntryView, 1, 1, 1, 2);
    connect(mEntryView, SIGNAL(selectionChanged()), SLOT(slotSelectionEntryViewChanged()));

    mChangeEmailButton = new QPushButton(i18n("Change Email..."), this);
    gridLayout->addWidget(mChangeEmailButton, 2, 1);
    connect(mChangeEmailButton, SIGNAL(clicked()), SLOT(changeEmail()));

    mRemoveEntryButton = new QPushButton(i18n("Remove Entry"), this);
    gridLayout->addWidget(mRemoveEntryButton, 2, 2);
    connect(mRemoveEntryButton, SIGNAL(clicked()), SLOT(removeEntry()));

    mManager = new DistributionListManager(mAddressBook);
    mManager->load();

    updateAddresseeView();
    updateNameCombo();
}
开发者ID:serghei,项目名称:kde3-kdelibs,代码行数:70,代码来源:distributionlistdialog.cpp


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