コード例 #1
0
TrackParameterBox::TrackParameterBox(QWidget *parent) :
    RosegardenParameterBox(tr("Track"), tr("Track Parameters"), parent),
    m_doc(NULL),
    m_selectedTrackId(NO_TRACK),
    m_lastInstrumentType(Instrument::InvalidInstrument)
{
    setObjectName("Track Parameter Box");

    QFontMetrics metrics(m_font);
    const int width11 = metrics.width("12345678901");
    const int width20 = metrics.width("12345678901234567890");
    const int width22 = metrics.width("1234567890123456789012");
    const int width25 = metrics.width("1234567890123456789012345");

    // Widgets

    // Label
    m_trackLabel = new SqueezedLabel(tr("<untitled>"), this);
    m_trackLabel->setAlignment(Qt::AlignCenter);
    m_trackLabel->setFont(m_font);

    // Playback parameters

    // Outer collapsing frame
    CollapsingFrame *playbackParametersFrame = new CollapsingFrame(
            tr("Playback parameters"), this, "trackparametersplayback", true);

    // Inner fixed widget
    // We need an inner widget so that we can have a layout.  The outer
    // CollapsingFrame already has its own layout.
    QWidget *playbackParameters = new QWidget(playbackParametersFrame);
    playbackParametersFrame->setWidget(playbackParameters);
    playbackParameters->setContentsMargins(3, 3, 3, 3);

    // Device
    QLabel *playbackDeviceLabel = new QLabel(tr("Device"), playbackParameters);
    playbackDeviceLabel->setFont(m_font);
    m_playbackDevice = new QComboBox(playbackParameters);
    m_playbackDevice->setToolTip(tr("<qt><p>Choose the device this track will use for playback.</p><p>Click <img src=\":pixmaps/toolbar/manage-midi-devices.xpm\"> to connect this device to a useful output if you do not hear sound</p></qt>"));
    m_playbackDevice->setMinimumWidth(width25);
    m_playbackDevice->setFont(m_font);
    connect(m_playbackDevice, SIGNAL(activated(int)),
            this, SLOT(slotPlaybackDeviceChanged(int)));

    // Instrument
    QLabel *instrumentLabel = new QLabel(tr("Instrument"), playbackParameters);
    instrumentLabel->setFont(m_font);
    m_instrument = new QComboBox(playbackParameters);
    m_instrument->setFont(m_font);
    m_instrument->setToolTip(tr("<qt><p>Choose the instrument this track will use for playback. (Configure the instrument in <b>Instrument Parameters</b>).</p></qt>"));
    m_instrument->setMaxVisibleItems(16);
    m_instrument->setMinimumWidth(width22);
    connect(m_instrument, SIGNAL(activated(int)),
            this, SLOT(slotInstrumentChanged(int)));

    // Archive
    QLabel *archiveLabel = new QLabel(tr("Archive"), playbackParameters);
    archiveLabel->setFont(m_font);
    m_archive = new QCheckBox(playbackParameters);
    m_archive->setFont(m_font);
    m_archive->setToolTip(tr("<qt><p>Check this to archive a track.  Archived tracks will not make sound.</p></qt>"));
    connect(m_archive, SIGNAL(clicked(bool)),
            this, SLOT(slotArchiveChanged(bool)));

    // Playback parameters layout

    // This automagically becomes playbackParameters's layout.
    QGridLayout *groupLayout = new QGridLayout(playbackParameters);
    groupLayout->setContentsMargins(5,0,0,5);
    groupLayout->setVerticalSpacing(2);
    groupLayout->setHorizontalSpacing(5);
    // Row 0: Device
    groupLayout->addWidget(playbackDeviceLabel, 0, 0);
    groupLayout->addWidget(m_playbackDevice, 0, 1);
    // Row 1: Instrument
    groupLayout->addWidget(instrumentLabel, 1, 0);
    groupLayout->addWidget(m_instrument, 1, 1);
    // Row 2: Archive
    groupLayout->addWidget(archiveLabel, 2, 0);
    groupLayout->addWidget(m_archive, 2, 1);
    // Let column 1 fill the rest of the space.
    groupLayout->setColumnStretch(1, 1);

    // Recording filters

    m_recordingFiltersFrame = new CollapsingFrame(
            tr("Recording filters"), this, "trackparametersrecord", false);

    QWidget *recordingFilters = new QWidget(m_recordingFiltersFrame);
    m_recordingFiltersFrame->setWidget(recordingFilters);
    recordingFilters->setContentsMargins(3, 3, 3, 3);

    // Device
    QLabel *recordDeviceLabel = new QLabel(tr("Device"), recordingFilters);
    recordDeviceLabel->setFont(m_font);
    m_recordingDevice = new QComboBox(recordingFilters);
    m_recordingDevice->setFont(m_font);
    m_recordingDevice->setToolTip(tr("<qt><p>This track will only record Audio/MIDI from the selected device, filtering anything else out</p></qt>"));
    m_recordingDevice->setMinimumWidth(width25);
    connect(m_recordingDevice, SIGNAL(activated(int)),
            this, SLOT(slotRecordingDeviceChanged(int)));

    // Channel
    QLabel *channelLabel = new QLabel(tr("Channel"), recordingFilters);
    channelLabel->setFont(m_font);
    m_recordingChannel = new QComboBox(recordingFilters);
    m_recordingChannel->setFont(m_font);
    m_recordingChannel->setToolTip(tr("<qt><p>This track will only record Audio/MIDI from the selected channel, filtering anything else out</p></qt>"));
    m_recordingChannel->setMaxVisibleItems(17);
    m_recordingChannel->setMinimumWidth(width11);
    m_recordingChannel->addItem(tr("All"));
    for (int i = 1; i < 17; ++i) {
        m_recordingChannel->addItem(QString::number(i));
    }
    connect(m_recordingChannel, SIGNAL(activated(int)),
            this, SLOT(slotRecordingChannelChanged(int)));

    // Thru Routing
    QLabel *thruLabel = new QLabel(tr("Thru Routing"), recordingFilters);
    thruLabel->setFont(m_font);
    m_thruRouting = new QComboBox(recordingFilters);
    m_thruRouting->setFont(m_font);
    //m_thruRouting->setToolTip(tr("<qt><p>Routing from the input device and channel to the instrument.</p></qt>"));
    m_thruRouting->setMinimumWidth(width11);
    m_thruRouting->addItem(tr("Auto"), Track::Auto);
    m_thruRouting->addItem(tr("On"), Track::On);
    m_thruRouting->addItem(tr("Off"), Track::Off);
    m_thruRouting->addItem(tr("When Armed"), Track::WhenArmed);
    connect(m_thruRouting, SIGNAL(activated(int)),
            this, SLOT(slotThruRoutingChanged(int)));

    // Recording filters layout

    groupLayout = new QGridLayout(recordingFilters);
    groupLayout->setContentsMargins(5,0,0,5);
    groupLayout->setVerticalSpacing(2);
    groupLayout->setHorizontalSpacing(5);
    // Row 0: Device
    groupLayout->addWidget(recordDeviceLabel, 0, 0);
    groupLayout->addWidget(m_recordingDevice, 0, 1);
    // Row 1: Channel
    groupLayout->addWidget(channelLabel, 1, 0);
    groupLayout->addWidget(m_recordingChannel, 1, 1);
    // Row 2: Thru Routing
    groupLayout->addWidget(thruLabel, 2, 0);
    groupLayout->addWidget(m_thruRouting, 2, 1);
    // Let column 1 fill the rest of the space.
    groupLayout->setColumnStretch(1, 1);

    // Staff export options

    m_staffExportOptionsFrame = new CollapsingFrame(
            tr("Staff export options"), this, "trackstaffgroup", false);

    QWidget *staffExportOptions = new QWidget(m_staffExportOptionsFrame);
    m_staffExportOptionsFrame->setWidget(staffExportOptions);
    staffExportOptions->setContentsMargins(2, 2, 2, 2);

    // Notation size (export only)
    //
    // NOTE: This is the only way to get a \small or \tiny inserted before the
    // first note in LilyPond export.  Setting the actual staff size on a
    // per-staff (rather than per-score) basis is something the author of the
    // LilyPond documentation has no idea how to do, so we settle for this,
    // which is not as nice, but actually a lot easier to implement.
    QLabel *notationSizeLabel = new QLabel(tr("Notation size:"), staffExportOptions);
    notationSizeLabel->setFont(m_font);
    m_notationSize = new QComboBox(staffExportOptions);
    m_notationSize->setFont(m_font);
    m_notationSize->setToolTip(tr("<qt><p>Choose normal, \\small or \\tiny font size for notation elements on this (normal-sized) staff when exporting to LilyPond.</p><p>This is as close as we get to enabling you to print parts in cue size</p></qt>"));
    m_notationSize->setMinimumWidth(width11);
    m_notationSize->addItem(tr("Normal"), StaffTypes::Normal);
    m_notationSize->addItem(tr("Small"), StaffTypes::Small);
    m_notationSize->addItem(tr("Tiny"), StaffTypes::Tiny);
    connect(m_notationSize, SIGNAL(activated(int)),
            this, SLOT(slotNotationSizeChanged(int)));

    // Bracket type
    // Staff bracketing (export only at the moment, but using this for GUI
    // rendering would be nice in the future!) //!!! 
    QLabel *bracketTypeLabel = new QLabel(tr("Bracket type:"), staffExportOptions);
    bracketTypeLabel->setFont(m_font);
    m_bracketType = new QComboBox(staffExportOptions);
    m_bracketType->setFont(m_font);
    m_bracketType->setToolTip(tr("<qt><p>Bracket staffs in LilyPond<br>(fragile, use with caution)</p><qt>"));
    m_bracketType->setMinimumWidth(width11);
    m_bracketType->addItem(tr("-----"), Brackets::None);
    m_bracketType->addItem(tr("[----"), Brackets::SquareOn);
    m_bracketType->addItem(tr("----]"), Brackets::SquareOff);
    m_bracketType->addItem(tr("[---]"), Brackets::SquareOnOff);
    m_bracketType->addItem(tr("{----"), Brackets::CurlyOn);
    m_bracketType->addItem(tr("----}"), Brackets::CurlyOff);
    m_bracketType->addItem(tr("{[---"), Brackets::CurlySquareOn);
    m_bracketType->addItem(tr("---]}"), Brackets::CurlySquareOff);
    connect(m_bracketType, SIGNAL(activated(int)),
            this, SLOT(slotBracketTypeChanged(int)));

    // Staff export options layout

    groupLayout = new QGridLayout(staffExportOptions);
    groupLayout->setContentsMargins(5,0,0,5);
    groupLayout->setVerticalSpacing(2);
    groupLayout->setHorizontalSpacing(5);
    groupLayout->setColumnStretch(1, 1);
    // Row 0: Notation size
    groupLayout->addWidget(notationSizeLabel, 0, 0, Qt::AlignLeft);
    groupLayout->addWidget(m_notationSize, 0, 1, 1, 2);
    // Row 1: Bracket type
    groupLayout->addWidget(bracketTypeLabel, 1, 0, Qt::AlignLeft);
    groupLayout->addWidget(m_bracketType, 1, 1, 1, 2);

    // Create segments with

    m_createSegmentsWithFrame = new CollapsingFrame(
            tr("Create segments with"), this, "trackparametersdefaults", false);

    QWidget *createSegmentsWith = new QWidget(m_createSegmentsWithFrame);
    m_createSegmentsWithFrame->setWidget(createSegmentsWith);
    createSegmentsWith->setContentsMargins(3, 3, 3, 3);

    // Preset
    m_presetLabel = new QLabel(tr("Preset"), createSegmentsWith);
    m_presetLabel->setFont(m_font);

    m_preset = new QLabel(tr("<none>"), createSegmentsWith);
    m_preset->setFont(m_font);
    m_preset->setObjectName("SPECIAL_LABEL");
    m_preset->setFrameStyle(QFrame::Panel | QFrame::Sunken);
    m_preset->setMinimumWidth(width20);

    m_load = new QPushButton(tr("Load"), createSegmentsWith);
    m_load->setFont(m_font);
    m_load->setToolTip(tr("<qt><p>Load a segment parameters preset from our comprehensive database of real-world instruments.</p><p>When you create new segments, they will have these parameters at the moment of creation.  To use these parameters on existing segments (eg. to convert an existing part in concert pitch for playback on a Bb trumpet) use <b>Segments -> Convert notation for</b> in the notation editor.</p></qt>"));
    connect(m_load, SIGNAL(released()),
            SLOT(slotLoadPressed()));

    // Clef
    m_clefLabel = new QLabel(tr("Clef"), createSegmentsWith);
    m_clefLabel->setFont(m_font);
    m_clef = new QComboBox(createSegmentsWith);
    m_clef->setFont(m_font);
    m_clef->setToolTip(tr("<qt><p>New segments will be created with this clef inserted at the beginning</p></qt>"));
    m_clef->setMinimumWidth(width11);
    m_clef->addItem(tr("treble", "Clef name"), TrebleClef);
    m_clef->addItem(tr("bass", "Clef name"), BassClef);
    m_clef->addItem(tr("crotales", "Clef name"), CrotalesClef);
    m_clef->addItem(tr("xylophone", "Clef name"), XylophoneClef);
    m_clef->addItem(tr("guitar", "Clef name"), GuitarClef);
    m_clef->addItem(tr("contrabass", "Clef name"), ContrabassClef);
    m_clef->addItem(tr("celesta", "Clef name"), CelestaClef);
    m_clef->addItem(tr("old celesta", "Clef name"), OldCelestaClef);
    m_clef->addItem(tr("french", "Clef name"), FrenchClef);
    m_clef->addItem(tr("soprano", "Clef name"), SopranoClef);
    m_clef->addItem(tr("mezzosoprano", "Clef name"), MezzosopranoClef);
    m_clef->addItem(tr("alto", "Clef name"), AltoClef);
    m_clef->addItem(tr("tenor", "Clef name"), TenorClef);
    m_clef->addItem(tr("baritone", "Clef name"), BaritoneClef);
    m_clef->addItem(tr("varbaritone", "Clef name"), VarbaritoneClef);
    m_clef->addItem(tr("subbass", "Clef name"), SubbassClef);
    m_clef->addItem(tr("twobar", "Clef name"), TwoBarClef);
    connect(m_clef, SIGNAL(activated(int)),
            this, SLOT(slotClefChanged(int)));

    // Transpose
    m_transposeLabel = new QLabel(tr("Transpose"), createSegmentsWith);
    m_transposeLabel->setFont(m_font);
    m_transpose = new QComboBox(createSegmentsWith);
    m_transpose->setFont(m_font);
    m_transpose->setToolTip(tr("<qt><p>New segments will be created with this transpose property set</p></qt>"));
    connect(m_transpose, SIGNAL(activated(int)),
            SLOT(slotTransposeChanged(int)));

    int transposeRange = 48;
    for (int i = -transposeRange; i < transposeRange + 1; i++) {
        m_transpose->addItem(QString("%1").arg(i));
        if (i == 0)
            m_transpose->setCurrentIndex(m_transpose->count() - 1);
    }

    // Pitch
    m_pitchLabel = new QLabel(tr("Pitch"), createSegmentsWith);
    m_pitchLabel->setFont(m_font);

    // Lowest playable note
    m_lowestLabel = new QLabel(tr("Lowest"), createSegmentsWith);
    m_lowestLabel->setFont(m_font);

    m_lowest = new QPushButton(tr("---"), createSegmentsWith);
    m_lowest->setFont(m_font);
    m_lowest->setToolTip(tr("<qt><p>Choose the lowest suggested playable note, using a staff</p></qt>"));
    connect(m_lowest, SIGNAL(released()),
            SLOT(slotLowestPressed()));

    // Highest playable note
    m_highestLabel = new QLabel(tr("Highest"), createSegmentsWith);
    m_highestLabel->setFont(m_font);

    m_highest = new QPushButton(tr("---"), createSegmentsWith);
    m_highest->setFont(m_font);
    m_highest->setToolTip(tr("<qt><p>Choose the highest suggested playable note, using a staff</p></qt>"));
    connect(m_highest, SIGNAL(released()),
            SLOT(slotHighestPressed()));

    // Color
    QLabel *colorLabel = new QLabel(tr("Color"), createSegmentsWith);
    colorLabel->setFont(m_font);
    m_color = new QComboBox(createSegmentsWith);
    m_color->setFont(m_font);
    m_color->setToolTip(tr("<qt><p>New segments will be created using this color</p></qt>"));
    m_color->setEditable(false);
    m_color->setMaxVisibleItems(20);
    connect(m_color, SIGNAL(activated(int)),
            SLOT(slotColorChanged(int)));

    // "Create segments with" layout

    groupLayout = new QGridLayout(createSegmentsWith);
    groupLayout->setContentsMargins(5,0,0,5);
    groupLayout->setVerticalSpacing(2);
    groupLayout->setHorizontalSpacing(5);
    // Row 0: Preset/Load
    groupLayout->addWidget(m_presetLabel, 0, 0, Qt::AlignLeft);
    groupLayout->addWidget(m_preset, 0, 1, 1, 3);
    groupLayout->addWidget(m_load, 0, 4, 1, 2);
    // Row 1: Clef/Transpose
    groupLayout->addWidget(m_clefLabel, 1, 0, Qt::AlignLeft);
    groupLayout->addWidget(m_clef, 1, 1, 1, 2);
    groupLayout->addWidget(m_transposeLabel, 1, 3, 1, 2, Qt::AlignRight);
    groupLayout->addWidget(m_transpose, 1, 5, 1, 1);
    // Row 2: Pitch/Lowest/Highest
    groupLayout->addWidget(m_pitchLabel, 2, 0, Qt::AlignLeft);
    groupLayout->addWidget(m_lowestLabel, 2, 1, Qt::AlignRight);
    groupLayout->addWidget(m_lowest, 2, 2, 1, 1);
    groupLayout->addWidget(m_highestLabel, 2, 3, Qt::AlignRight);
    groupLayout->addWidget(m_highest, 2, 4, 1, 2);
    // Row 3: Color
    groupLayout->addWidget(colorLabel, 3, 0, Qt::AlignLeft);
    groupLayout->addWidget(m_color, 3, 1, 1, 5);

    groupLayout->setColumnStretch(1, 1);
    groupLayout->setColumnStretch(2, 2);

    // Connections

    connect(Instrument::getStaticSignals().data(),
            SIGNAL(changed(Instrument *)),
            this,
            SLOT(slotInstrumentChanged(Instrument *)));

    // Layout

    QGridLayout *mainLayout = new QGridLayout(this);
    mainLayout->setMargin(0);
    mainLayout->setSpacing(1);
    mainLayout->addWidget(m_trackLabel, 0, 0);
    mainLayout->addWidget(playbackParametersFrame, 1, 0);
    mainLayout->addWidget(m_recordingFiltersFrame, 2, 0);
    mainLayout->addWidget(m_staffExportOptionsFrame, 3, 0);
    mainLayout->addWidget(m_createSegmentsWithFrame, 4, 0);

    // Box

    setContentsMargins(2, 7, 2, 2);

    updateWidgets2();
}
コード例 #2
0
ファイル: OptionsView.cpp プロジェクト: wzssyqa/opticks-cmake
OptionsView::OptionsView() :
   QWidget(NULL)
{
   // Initial Size
   mpFixedSizeRadio = new QRadioButton("Fixed Size", this);
   mpMaximizedRadio = new QRadioButton("Maximized", this);
   mpPercentageRadio = new QRadioButton("Percentage:", this);
   QButtonGroup* pInitialSizeGroup = new QButtonGroup(this);
   pInitialSizeGroup->addButton(mpFixedSizeRadio);
   pInitialSizeGroup->addButton(mpMaximizedRadio);
   pInitialSizeGroup->addButton(mpPercentageRadio);

   QLabel* pWidthLabel = new QLabel("Width:", this);
   mpWidthSpin = new QSpinBox(this);
   mpWidthSpin->setRange(1, numeric_limits<int>::max());
   mpWidthSpin->setSuffix(" Pixel(s)");

   QLabel* pHeightLabel = new QLabel("Height:", this);
   mpHeightSpin = new QSpinBox(this);
   mpHeightSpin->setRange(1, numeric_limits<int>::max());
   mpHeightSpin->setSuffix(" Pixel(s)");

   mpPercentageSpin = new QSpinBox(this);
   mpPercentageSpin->setRange(0, 100);
   mpPercentageSpin->setSuffix("%");

   QHBoxLayout* pPercentageLayout = new QHBoxLayout();
   pPercentageLayout->addWidget(mpPercentageRadio);
   pPercentageLayout->addWidget(mpPercentageSpin);
   pPercentageLayout->addStretch(10);

   QWidget* pInitialSizeWidget = new QWidget(this);
   QGridLayout* pInitialSizeLayout = new QGridLayout(pInitialSizeWidget);
   pInitialSizeLayout->setMargin(0);
   pInitialSizeLayout->setSpacing(5);
   pInitialSizeLayout->addWidget(mpFixedSizeRadio, 0, 0, 1, 3);
   pInitialSizeLayout->addWidget(pWidthLabel, 1, 1);
   pInitialSizeLayout->addWidget(mpWidthSpin, 1, 2);
   pInitialSizeLayout->addWidget(pHeightLabel, 2, 1);
   pInitialSizeLayout->addWidget(mpHeightSpin, 2, 2);
   pInitialSizeLayout->addWidget(mpMaximizedRadio, 3, 0, 1, 3);
   pInitialSizeLayout->addLayout(pPercentageLayout, 4, 0, 1, 4);
   pInitialSizeLayout->setColumnStretch(3, 10);
   pInitialSizeLayout->setColumnMinimumWidth(0, 10);
   LabeledSection* pInitialSizeSection = new LabeledSection(pInitialSizeWidget, "Default Size", this);

   // Initial Zoom
   mpZoomToFitRadio = new QRadioButton("Zoom To Fit", this);
   mpZoomPercentRadio = new QRadioButton("Percentage:", this);
   mpZoomPercentSpin = new QSpinBox(this);
   mpZoomPercentSpin->setRange(0, numeric_limits<int>::max());
   mpZoomPercentSpin->setSuffix("%");
   QButtonGroup* pInitialZoomGroup = new QButtonGroup(this);
   pInitialZoomGroup->addButton(mpZoomToFitRadio);
   pInitialZoomGroup->addButton(mpZoomPercentRadio);

   QWidget* pInitialZoomWidget = new QWidget(this);
   QGridLayout* pInitialZoomLayout = new QGridLayout(pInitialZoomWidget);
   pInitialZoomLayout->setMargin(0);
   pInitialZoomLayout->setSpacing(5);
   pInitialZoomLayout->addWidget(mpZoomToFitRadio, 0, 0, 1, 3);
   pInitialZoomLayout->addWidget(mpZoomPercentRadio, 1, 0);
   pInitialZoomLayout->addWidget(mpZoomPercentSpin, 1, 1);
   pInitialZoomLayout->setColumnStretch(2, 10);
   LabeledSection* pInitialZoomSection = new LabeledSection(pInitialZoomWidget, "Default Zoom", this);

   // Copy Snapshot
   mpResolutionWidget = new ResolutionWidget();
   LabeledSection* pResolutionSection = new LabeledSection(mpResolutionWidget, "Copy Snapshot", this);
   mpResolutionWidget->setAspectRatioLock(View::getSettingAspectRatioLock());
   mpResolutionWidget->setResolution(View::getSettingOutputWidth(), View::getSettingOutputHeight());
   mpResolutionWidget->setUseViewResolution(View::getSettingUseViewResolution());

   // Other Initial Options
   QLabel* pBackgroundLabel = new QLabel("Background Color:", this);
   mpBackgroundColor = new CustomColorButton(this);
   mpBackgroundColor->usePopupGrid(true);

   QLabel* pOriginLabel = new QLabel("Origin Location:", this);
   mpOriginCombo = new QComboBox(this);
   mpOriginCombo->setEditable(false);
   mpOriginCombo->addItem("Lower Left");
   mpOriginCombo->addItem("Upper Left");

   mpConfirmClose = new QCheckBox("Confirm Close", this);

   QWidget* pOtherOptWidget = new QWidget(this);
   QGridLayout* pOtherOptLayout = new QGridLayout(pOtherOptWidget);
   pOtherOptLayout->setMargin(0);
   pOtherOptLayout->setSpacing(5);
   pOtherOptLayout->addWidget(pBackgroundLabel, 0, 0);
   pOtherOptLayout->addWidget(mpBackgroundColor, 0, 1, Qt::AlignLeft);
   pOtherOptLayout->addWidget(pOriginLabel, 1, 0);
   pOtherOptLayout->addWidget(mpOriginCombo, 1, 1, Qt::AlignLeft);
   pOtherOptLayout->addWidget(mpConfirmClose, 2, 0, 1, 2);
   pOtherOptLayout->setColumnStretch(1, 10);
   LabeledSection* pOtherOptSection = new LabeledSection(pOtherOptWidget, "Other Default Properties", this);
   
   // Dialog layout
   QVBoxLayout* pLayout = new QVBoxLayout(this);
   pLayout->setMargin(0);
   pLayout->setSpacing(10);
   pLayout->addWidget(pInitialSizeSection);
   pLayout->addWidget(pInitialZoomSection);
   pLayout->addWidget(pResolutionSection);
   pLayout->addWidget(pOtherOptSection);
   pLayout->addStretch(10);

   //Connections
   connect(mpZoomPercentRadio, SIGNAL(toggled(bool)), mpZoomPercentSpin, SLOT(setEnabled(bool)));
   connect(mpFixedSizeRadio, SIGNAL(toggled(bool)), pHeightLabel, SLOT(setEnabled(bool)));
   connect(mpFixedSizeRadio, SIGNAL(toggled(bool)), mpHeightSpin, SLOT(setEnabled(bool)));
   connect(mpFixedSizeRadio, SIGNAL(toggled(bool)), pWidthLabel, SLOT(setEnabled(bool)));
   connect(mpFixedSizeRadio, SIGNAL(toggled(bool)), mpWidthSpin, SLOT(setEnabled(bool)));
   connect(mpPercentageRadio, SIGNAL(toggled(bool)), mpPercentageSpin, SLOT(setEnabled(bool)));

   // Initialize From Settings
   WindowSizeType sizeType = WorkspaceWindow::getSettingWindowSize();
   mpHeightSpin->setValue(WorkspaceWindow::getSettingWindowHeight());
   mpWidthSpin->setValue(WorkspaceWindow::getSettingWindowWidth());
   mpPercentageSpin->setValue(WorkspaceWindow::getSettingWindowPercentage());

   mpFixedSizeRadio->setChecked(sizeType == FIXED_SIZE);
   mpMaximizedRadio->setChecked(sizeType == MAXIMIZED);
   mpPercentageRadio->setChecked(sizeType == WORKSPACE_PERCENTAGE);
   pHeightLabel->setEnabled(sizeType == FIXED_SIZE);
   mpHeightSpin->setEnabled(sizeType == FIXED_SIZE);
   pWidthLabel->setEnabled(sizeType == FIXED_SIZE);
   mpWidthSpin->setEnabled(sizeType == FIXED_SIZE);
   mpPercentageSpin->setEnabled(sizeType == WORKSPACE_PERCENTAGE);

   unsigned int zoomPercentage = PerspectiveView::getSettingZoomPercentage();
   if (zoomPercentage == 0)
   {
      mpZoomToFitRadio->setChecked(true);
      mpZoomPercentSpin->setEnabled(false);
      mpZoomPercentSpin->setValue(100);
   }
   else
   {
      mpZoomPercentRadio->setChecked(true);
      mpZoomPercentSpin->setEnabled(true);
      mpZoomPercentSpin->setValue(zoomPercentage);
   }

   DataOrigin origin = View::getSettingDataOrigin();
   if (origin == LOWER_LEFT)
   {
      mpOriginCombo->setCurrentIndex(0);
   }
   else if (origin == UPPER_LEFT)
   {
      mpOriginCombo->setCurrentIndex(1);
   }

   mpBackgroundColor->setColor(View::getSettingBackgroundColor());
   mpConfirmClose->setChecked(WorkspaceWindow::getSettingConfirmClose());
}
コード例 #3
0
void
QvisLegacyStreamlinePlotWindow::CreateWindowContents()
{
    QGridLayout *mainLayout = new QGridLayout(topLayout, 5, 2, 10, "mainLayout");

    // Create the step length text field.
    mainLayout->addWidget(new QLabel(tr("Step length"), central, "stepLengthLabel"),0,0);
    stepLength = new QLineEdit(central, "stepLength");
    connect(stepLength, SIGNAL(returnPressed()),
            this, SLOT(stepLengthProcessText()));
    mainLayout->addWidget(stepLength, 0,1);

    // Create the maximum time text field.
    mainLayout->addWidget(new QLabel(tr("Maximum steps"), central, "maxTimeLabel"),1,0);
    maxTime = new QLineEdit(central, "maxTime");
    connect(maxTime, SIGNAL(returnPressed()),
            this, SLOT(maxTimeProcessText()));
    mainLayout->addWidget(maxTime, 1,1);

    //
    // Create a tab widget so we can split source type and appearance.
    //
    QTabWidget *tabs = new QTabWidget(central, "tabs");
    mainLayout->addMultiCellWidget(tabs, 2,2,0,1);

    //
    // Create a tab for the streamline source widgets.
    //
    QGroupBox *topPageSource = new QGroupBox(central, "topPageSource");
    topPageSource->setFrameStyle(QFrame::NoFrame);
    tabs->addTab(topPageSource, tr("Streamline source"));
    QVBoxLayout *topSourceLayout = new QVBoxLayout(topPageSource);
    topSourceLayout->setMargin(10);
    topSourceLayout->setSpacing(5);

    // Create the source type combo box.
    QHBoxLayout *hLayout = new QHBoxLayout(topSourceLayout);
    hLayout->addWidget(new QLabel(tr("Source type"), topPageSource, "sourceTypeLabel"));
    sourceType = new QComboBox(topPageSource, "sourceType");
    sourceType->insertItem(tr("Point"));
    sourceType->insertItem(tr("Line"));
    sourceType->insertItem(tr("Plane"));
    sourceType->insertItem(tr("Sphere"));
    sourceType->insertItem(tr("Box"));
    connect(sourceType, SIGNAL(activated(int)),
            this, SLOT(sourceTypeChanged(int)));
    hLayout->addWidget(sourceType, 10);
    topSourceLayout->addSpacing(5);

    // Create a group box for the source attributes.
    QGroupBox *pageSource = new QGroupBox(topPageSource, "pageSource");
    sourceAtts = pageSource;
    sourceAtts->setTitle(tr("Point"));
    topSourceLayout->addWidget(pageSource);
    topSourceLayout->addStretch(5);
    QVBoxLayout *svLayout = new QVBoxLayout(pageSource, 10, 2);
    svLayout->addSpacing(10);
    QGridLayout *sLayout = new QGridLayout(svLayout, 16, 2);
//    sLayout->setMargin(10);
    sLayout->setSpacing(5);

    // Create the widgets that specify a point source.
    pointSource = new QLineEdit(pageSource, "pointSource");
    connect(pointSource, SIGNAL(returnPressed()),
            this, SLOT(pointSourceProcessText()));
    pointSourceLabel = new QLabel(pointSource, tr("Location"), pageSource, "pointSourceLabel");
    sLayout->addWidget(pointSourceLabel, 3, 0);
    sLayout->addWidget(pointSource, 3,1);

    // Create the widgets that specify a line source.
    lineStart = new QLineEdit(pageSource, "lineStart");
    connect(lineStart, SIGNAL(returnPressed()),
            this, SLOT(lineStartProcessText()));
    lineStartLabel = new QLabel(lineStart, tr("Start"), pageSource, "lineStartLabel");
    sLayout->addWidget(lineStartLabel,4,0);
    sLayout->addWidget(lineStart, 4,1);

    lineEnd = new QLineEdit(pageSource, "lineEnd");
    connect(lineEnd, SIGNAL(returnPressed()),
            this, SLOT(lineEndProcessText()));
    lineEndLabel = new QLabel(lineEnd, tr("End"), pageSource, "lineEndLabel");
    sLayout->addWidget(lineEndLabel,5,0);
    sLayout->addWidget(lineEnd, 5,1);

    // Create the widgets that specify a plane source.
    planeOrigin = new QLineEdit(pageSource, "planeOrigin");
    connect(planeOrigin, SIGNAL(returnPressed()),
            this, SLOT(planeOriginProcessText()));
    planeOriginLabel = new QLabel(planeOrigin, tr("Origin"), pageSource, "planeOriginLabel");
    sLayout->addWidget(planeOriginLabel,6,0);
    sLayout->addWidget(planeOrigin, 6,1);

    planeNormal = new QLineEdit(pageSource, "planeNormal");
    connect(planeNormal, SIGNAL(returnPressed()),
            this, SLOT(planeNormalProcessText()));
    planeNormalLabel = new QLabel(planeNormal, tr("Normal"), pageSource, "planeNormalLabel");
    sLayout->addWidget(planeNormalLabel,7,0);
    sLayout->addWidget(planeNormal, 7,1);

    planeUpAxis = new QLineEdit(pageSource, "planeUpAxis");
    connect(planeUpAxis, SIGNAL(returnPressed()),
            this, SLOT(planeUpAxisProcessText()));
    planeUpAxisLabel = new QLabel(planeUpAxis, tr("Up axis"), pageSource, "planeUpAxisLabel");
    sLayout->addWidget(planeUpAxisLabel,8,0);
    sLayout->addWidget(planeUpAxis, 8,1);

    planeRadius = new QLineEdit(pageSource, "planeRadius");
    connect(planeRadius, SIGNAL(returnPressed()),
            this, SLOT(planeRadiusProcessText()));
    planeRadiusLabel = new QLabel(planeRadius, tr("Radius"), pageSource, "planeRadiusLabel");
    sLayout->addWidget(planeRadiusLabel,9,0);
    sLayout->addWidget(planeRadius, 9,1);

    // Create the widgets that specify a sphere source.
    sphereOrigin = new QLineEdit(pageSource, "sphereOrigin");
    connect(sphereOrigin, SIGNAL(returnPressed()),
            this, SLOT(sphereOriginProcessText()));
    sphereOriginLabel = new QLabel(sphereOrigin, tr("Origin"), pageSource, "sphereOriginLabel");
    sLayout->addWidget(sphereOriginLabel,10,0);
    sLayout->addWidget(sphereOrigin, 10,1);

    sphereRadius = new QLineEdit(pageSource, "sphereRadius");
    connect(sphereRadius, SIGNAL(returnPressed()),
            this, SLOT(sphereRadiusProcessText()));
    sphereRadiusLabel = new QLabel(sphereRadius, tr("Radius"), pageSource, "sphereRadiusLabel");
    sLayout->addWidget(sphereRadiusLabel,11,0);
    sLayout->addWidget(sphereRadius, 11,1);

    // Create the widgets that specify a box source
    useWholeBox = new QCheckBox(tr("Whole data set"), 
                                pageSource, "useWholeBox");
    connect(useWholeBox, SIGNAL(toggled(bool)),
            this, SLOT(useWholeBoxChanged(bool)));
    sLayout->addWidget(useWholeBox, 12, 0);

    boxExtents[0] = new QLineEdit(pageSource, "boxExtents[0]");
    connect(boxExtents[0], SIGNAL(returnPressed()),
            this, SLOT(boxExtentsProcessText()));
    boxExtentsLabel[0] = new QLabel(boxExtents[0], tr("X Extents"), pageSource, "boxExtentsLabel[0]");
    sLayout->addWidget(boxExtentsLabel[0], 13, 0);
    sLayout->addWidget(boxExtents[0], 13, 1);
    boxExtents[1] = new QLineEdit(pageSource, "boxExtents[1]");
    connect(boxExtents[1], SIGNAL(returnPressed()),
            this, SLOT(boxExtentsProcessText()));
    boxExtentsLabel[1] = new QLabel(boxExtents[1], tr("Y Extents"), pageSource, "boxExtentsLabel[1]");
    sLayout->addWidget(boxExtentsLabel[1], 14, 0);
    sLayout->addWidget(boxExtents[1], 14, 1);
    boxExtents[2] = new QLineEdit(pageSource, "boxExtents[2]");
    connect(boxExtents[2], SIGNAL(returnPressed()),
            this, SLOT(boxExtentsProcessText()));
    boxExtentsLabel[2] = new QLabel(boxExtents[2], tr("Z Extents"), pageSource, "boxExtentsLabel[2]");
    sLayout->addWidget(boxExtentsLabel[2], 15, 0);
    sLayout->addWidget(boxExtents[2], 15, 1);

    //
    // Create appearance-related widgets.
    //
    QGroupBox *pageAppearance = new QGroupBox(central, "pageAppearance");
    pageAppearance->setFrameStyle(QFrame::NoFrame);
    tabs->addTab(pageAppearance, tr("Appearance"));
    QGridLayout *aLayout = new QGridLayout(pageAppearance, 7, 2);
    aLayout->setMargin(10);
    aLayout->setSpacing(5);

    // Create widgets that help determine the appearance of the streamlines.
    displayMethod = new QComboBox(pageAppearance, "displayMethod");
    displayMethod->insertItem(tr("Lines"), 0);
    displayMethod->insertItem(tr("Tubes"), 1);
    displayMethod->insertItem(tr("Ribbons"), 2);
    connect(displayMethod, SIGNAL(activated(int)),
            this, SLOT(displayMethodChanged(int)));
    aLayout->addWidget(new QLabel(displayMethod, tr("Display as"),
        pageAppearance, "displayMethodLabel"), 0,0);
    aLayout->addWidget(displayMethod, 0,1);

    showStart = new QCheckBox(tr("Show start"), pageAppearance, "showStart");
    connect(showStart, SIGNAL(toggled(bool)),
            this, SLOT(showStartChanged(bool)));
    aLayout->addWidget(showStart, 1,1);

    radius = new QLineEdit(pageAppearance, "radius");
    connect(radius, SIGNAL(returnPressed()),
            this, SLOT(radiusProcessText()));
    radiusLabel = new QLabel(radius, tr("Radius"), pageAppearance, "radiusLabel");
    QToolTip::add(radiusLabel, tr("Radius used for tubes and ribbons."));
    aLayout->addWidget(radiusLabel,2,0);
    aLayout->addWidget(radius, 2,1);

    lineWidth = new QvisLineWidthWidget(0, pageAppearance, "lineWidth");
    connect(lineWidth, SIGNAL(lineWidthChanged(int)),
            this, SLOT(lineWidthChanged(int)));
    lineWidthLabel = new QLabel(lineWidth, tr("Line width"), pageAppearance, "lineWidthLabel");
    aLayout->addWidget(lineWidthLabel,3,0);
    aLayout->addWidget(lineWidth, 3,1);

    coloringMethod = new QComboBox(pageAppearance, "coloringMethod");
    coloringMethod->insertItem(tr("Solid"),0);
    coloringMethod->insertItem(tr("Speed"),1);
    coloringMethod->insertItem(tr("Vorticity magnitude"),2);
    connect(coloringMethod, SIGNAL(activated(int)),
            this, SLOT(coloringMethodChanged(int)));
    aLayout->addWidget(new QLabel(coloringMethod, tr("Color by"), 
        pageAppearance, "colorbylabel"), 4,0);
    aLayout->addWidget(coloringMethod, 4,1);

    colorTableName = new QvisColorTableButton(pageAppearance, "colorTableName");
    connect(colorTableName, SIGNAL(selectedColorTable(bool, const QString&)),
            this, SLOT(colorTableNameChanged(bool, const QString&)));
    colorTableNameLabel = new QLabel(colorTableName, tr("Color table"), pageAppearance, "colorTableNameLabel");
    aLayout->addWidget(colorTableNameLabel,5,0);
    aLayout->addWidget(colorTableName, 5,1, Qt::AlignLeft);

    singleColor = new QvisColorButton(pageAppearance, "singleColor");
    connect(singleColor, SIGNAL(selectedColor(const QColor&)),
            this, SLOT(singleColorChanged(const QColor&)));
    singleColorLabel = new QLabel(singleColor, tr("Single color"), pageAppearance, "singleColorLabel");
    aLayout->addWidget(singleColorLabel,6,0);
    aLayout->addWidget(singleColor, 6,1, Qt::AlignLeft);

    //
    // Create the widget that lets the user set the point density.
    //
    mainLayout->addWidget(new QLabel(tr("Point density"), central, "pointDensityLabel"),3,0);
    pointDensity = new QSpinBox(1, 30, 1, central, "pointDensity");
    connect(pointDensity, SIGNAL(valueChanged(int)), 
            this, SLOT(pointDensityChanged(int)));
    mainLayout->addWidget(pointDensity, 3,1);

    //Create the direction of integration.
    mainLayout->addWidget(new QLabel(tr("Streamline direction"), central, "streamlineDirectionLabel"),4,0);
    directionType = new QComboBox(central, "directionType");
    directionType->insertItem(tr("Forward"));
    directionType->insertItem(tr("Backward"));
    directionType->insertItem(tr("Both"));
    connect(directionType, SIGNAL(activated(int)),
            this, SLOT(directionTypeChanged(int)));
    mainLayout->addWidget(directionType, 4,1);

    legendFlag = new QCheckBox(tr("Legend"), central, "legendFlag");
    connect(legendFlag, SIGNAL(toggled(bool)),
            this, SLOT(legendFlagChanged(bool)));
    mainLayout->addWidget(legendFlag, 5,0);

    lightingFlag = new QCheckBox(tr("Lighting"), central, "lightingFlag");
    connect(lightingFlag, SIGNAL(toggled(bool)),
            this, SLOT(lightingFlagChanged(bool)));
    mainLayout->addWidget(lightingFlag, 5,1);

}
コード例 #4
0
void
QvisTensorPlotWindow::CreateWindowContents()
{
    QTabWidget *propertyTabs = new QTabWidget(central);
    topLayout->addWidget(propertyTabs);

    // ----------------------------------------------------------------------
    // First tab
    // ----------------------------------------------------------------------
    QWidget *firstTab = new QWidget(central);
    propertyTabs->addTab(firstTab, tr("Data"));
    
    QGridLayout *mainLayout = new QGridLayout(firstTab);


    //
    // Create the scale-related widgets.
    //
    QGroupBox * scaleGroupBox = new QGroupBox(central);
    scaleGroupBox->setTitle(tr("Scale"));
    mainLayout->addWidget(scaleGroupBox);

    QGridLayout *sgLayout = new QGridLayout(scaleGroupBox);
    sgLayout->setMargin(5);
    sgLayout->setSpacing(10);
    sgLayout->setColumnStretch(1, 10);

    // Add the scale line edit.
    scaleLineEdit = new QLineEdit(scaleGroupBox);
    connect(scaleLineEdit, SIGNAL(returnPressed()),
            this, SLOT(processScaleText()));
    sgLayout->addWidget(scaleLineEdit, 0, 1);
    QLabel *scaleLabel = new QLabel(tr("Scale"), scaleGroupBox);
    scaleLabel->setBuddy(scaleLineEdit);
    sgLayout->addWidget(scaleLabel, 0, 0, Qt::AlignRight | Qt::AlignVCenter);

    // Add the scale by magnitude toggle button.
    scaleByMagnitudeToggle = new QCheckBox(tr("Scale by magnitude"), scaleGroupBox);
    connect(scaleByMagnitudeToggle, SIGNAL(clicked(bool)), 
            this, SLOT(scaleByMagnitudeToggled(bool)));
    sgLayout->addWidget(scaleByMagnitudeToggle, 1, 0, 1, 2);

    // Add the auto scale toggle button.
    autoScaleToggle = new QCheckBox(tr("Auto scale"), scaleGroupBox);
    connect(autoScaleToggle, SIGNAL(clicked(bool)),
            this, SLOT(autoScaleToggled(bool)));
    sgLayout->addWidget(autoScaleToggle, 2, 0, 1, 2);


    //
    // Create the reduce-related widgets.
    //
    QGroupBox * reduceGroupBox = new QGroupBox(central);
    reduceGroupBox->setTitle(tr("Reduce by"));
    mainLayout->addWidget(reduceGroupBox);
    QGridLayout *rgLayout = new QGridLayout(reduceGroupBox);
    rgLayout->setSpacing(10);
//    rgLayout->setColumnStretch(1, 10);

    // Create the reduce button group.
    reduceButtonGroup = new QButtonGroup(reduceGroupBox);
    connect(reduceButtonGroup, SIGNAL(buttonClicked(int)),
            this, SLOT(reduceMethodChanged(int)));
    QRadioButton *rb = new QRadioButton(tr("N tensors"), reduceGroupBox);
    rb->setChecked(true);
    reduceButtonGroup->addButton(rb, 0);
    rgLayout->addWidget(rb, 0, 0);
    rb = new QRadioButton(tr("Stride"), reduceGroupBox);
    reduceButtonGroup->addButton(rb, 1);
    rgLayout->addWidget(rb, 1, 0);

    // Add the N tensors line edit.
    nTensorsLineEdit = new QLineEdit(reduceGroupBox);
    connect(scaleLineEdit, SIGNAL(returnPressed()),
            this, SLOT(processNTensorsText()));
    rgLayout->addWidget(nTensorsLineEdit, 0, 1);

    // Add the stride line edit.
    strideLineEdit = new QLineEdit(reduceGroupBox);
    connect(strideLineEdit, SIGNAL(returnPressed()),
            this, SLOT(processStrideText()));
    rgLayout->addWidget(strideLineEdit, 1, 1);



    // ----------------------------------------------------------------------
    // Second tab
    // ----------------------------------------------------------------------
    QWidget *secondTab = new QWidget(central);
    propertyTabs->addTab(secondTab, tr("Display"));
    
    mainLayout = new QGridLayout(secondTab);

    //
    // Create the color-related widgets.
    //
    QGroupBox * colorGroupBox = new QGroupBox(central);
    colorGroupBox->setTitle(tr("Color"));
    mainLayout->addWidget(colorGroupBox);

    QGridLayout *cgLayout = new QGridLayout(colorGroupBox);
    cgLayout->setMargin(5);
    cgLayout->setSpacing(10);
    cgLayout->setColumnStretch(1, 10);

    // Add the tensor color label.
    colorButtonGroup = new QButtonGroup(colorGroupBox);
    connect(colorButtonGroup, SIGNAL(buttonClicked(int)),
            this, SLOT(colorModeChanged(int)));
    rb = new QRadioButton(tr("Eigenvalues"), colorGroupBox);
    colorButtonGroup->addButton(rb, 0);
    cgLayout->addWidget(rb, 0, 0);
    rb = new QRadioButton(tr("Constant"), colorGroupBox);
    rb->setChecked(true);
    colorButtonGroup->addButton(rb, 1);
    cgLayout->addWidget(rb, 1, 0);

    // Create the color-by-eigenvalues button.
    colorTableWidget = new QvisColorTableWidget(colorGroupBox, true);
    connect(colorTableWidget, SIGNAL(selectedColorTable(bool, const QString &)),
            this, SLOT(colorTableClicked(bool, const QString &)));
    connect(colorTableWidget,
            SIGNAL(invertColorTableToggled(bool)),
            this,
            SLOT(invertColorTableToggled(bool)));
    cgLayout->addWidget(colorTableWidget, 0, 1, Qt::AlignLeft | Qt::AlignVCenter);

    // Create the tensor color button.
    tensorColor = new QvisColorButton(colorGroupBox);
    tensorColor->setButtonColor(QColor(255, 0, 0));
    connect(tensorColor, SIGNAL(selectedColor(const QColor &)),
            this, SLOT(tensorColorChanged(const QColor &)));
    cgLayout->addWidget(tensorColor, 1, 1, Qt::AlignLeft | Qt::AlignVCenter);

    //
    // Create the misc stuff
    //
    QGroupBox * miscGroup = new QGroupBox(central);
    miscGroup->setTitle(tr("Misc"));
    mainLayout->addWidget(miscGroup);

    QGridLayout *miscLayout = new QGridLayout(miscGroup);
    miscLayout->setMargin(5);
    miscLayout->setSpacing(10);
 
    // Create the legend toggle
    legendToggle = new QCheckBox(tr("Legend"), central);
    connect(legendToggle, SIGNAL(toggled(bool)),
            this, SLOT(legendToggled(bool)));
    miscLayout->addWidget(legendToggle, 0, 0);
}
コード例 #5
0
ファイル: playlist.cpp プロジェクト: CSRedRat/vlc
PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
               : QWidget( _par ), p_intf ( _p_i )
{

    setContentsMargins( 0, 3, 0, 3 );

    QGridLayout *layout = new QGridLayout( this );
    layout->setMargin( 0 ); layout->setSpacing( 0 );

    /*******************
     * Left            *
     *******************/
    /* We use a QSplitter for the left part */
    leftSplitter = new QSplitter( Qt::Vertical, this );

    /* Source Selector */
    selector = new PLSelector( this, p_intf );
    leftSplitter->addWidget( selector );

    /* Create a Container for the Art Label
       in order to have a beautiful resizing for the selector above it */
    artContainer = new QStackedWidget;
    artContainer->setMaximumHeight( 128 );

    /* Art label */
    CoverArtLabel *art = new CoverArtLabel( artContainer, p_intf );
    art->setToolTip( qtr( "Double click to get media information" ) );
    artContainer->addWidget( art );

    CONNECT( THEMIM->getIM(), artChanged( QString ),
             art, showArtUpdate( const QString& ) );

    leftSplitter->addWidget( artContainer );

    /*******************
     * Right           *
     *******************/
    /* Initialisation of the playlist */
    playlist_t * p_playlist = THEPL;
    PL_LOCK;
    playlist_item_t *p_root = p_playlist->p_playing;
    PL_UNLOCK;

    setMinimumWidth( 400 );

    PLModel *model = PLModel::getPLModel( p_intf );
#ifdef MEDIA_LIBRARY
    MLModel *mlmodel = new MLModel( p_intf, this );
    mainView = new StandardPLPanel( this, p_intf, p_root, selector, model, mlmodel );
#else
    mainView = new StandardPLPanel( this, p_intf, p_root, selector, model, NULL );
#endif

    /* Location Bar */
    locationBar = new LocationBar( model );
    locationBar->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Preferred );
    layout->addWidget( locationBar, 0, 0, 1, 2 );
    layout->setColumnStretch( 0, 5 );
    CONNECT( locationBar, invoked( const QModelIndex & ),
             mainView, browseInto( const QModelIndex & ) );

    QHBoxLayout *topbarLayout = new QHBoxLayout();
    layout->addLayout( topbarLayout, 0, 1 );
    topbarLayout->setSpacing( 10 );

    /* Button to switch views */
    QToolButton *viewButton = new QToolButton( this );
    viewButton->setIcon( style()->standardIcon( QStyle::SP_FileDialogDetailedView ) );
    viewButton->setToolTip( qtr("Change playlistview") );
    topbarLayout->addWidget( viewButton );

    /* View selection menu */
    QSignalMapper *viewSelectionMapper = new QSignalMapper( this );
    CONNECT( viewSelectionMapper, mapped( int ), mainView, showView( int ) );

    QActionGroup *actionGroup = new QActionGroup( this );

#ifndef NDEBUG
# define MAX_VIEW StandardPLPanel::VIEW_COUNT
#else
# define MAX_VIEW StandardPLPanel::VIEW_COUNT - 1
#endif
    for( int i = 0; i < MAX_VIEW; i++ )
    {
        viewActions[i] = actionGroup->addAction( viewNames[i] );
        viewActions[i]->setCheckable( true );
        viewSelectionMapper->setMapping( viewActions[i], i );
        CONNECT( viewActions[i], triggered(), viewSelectionMapper, map() );
    }
    viewActions[0]->setChecked( true );

    QMenu *viewMenu = new QMenu( viewButton );
    viewMenu->addActions( actionGroup->actions() );
    viewButton->setMenu( viewMenu );
    CONNECT( viewButton, clicked(), mainView, cycleViews() );

    /* Search */
    searchEdit = new SearchLineEdit( this );
    searchEdit->setMaximumWidth( 250 );
    searchEdit->setMinimumWidth( 80 );
    searchEdit->setToolTip( qtr("Search the playlist") );
    topbarLayout->addWidget( searchEdit );
    CONNECT( searchEdit, textChanged( const QString& ),
             mainView, search( const QString& ) );
    CONNECT( searchEdit, searchDelayedChanged( const QString& ),
             mainView, searchDelayed( const QString & ) );

    CONNECT( mainView, viewChanged( const QModelIndex& ),
             this, changeView( const QModelIndex &) );

    /* Connect the activation of the selector to a redefining of the PL */
    DCONNECT( selector, categoryActivated( playlist_item_t *, bool ),
              mainView, setRootItem( playlist_item_t *, bool ) );
    mainView->setRootItem( p_root, false );

    /* */
    split = new PlaylistSplitter( this );

    /* Add the two sides of the QSplitter */
    split->addWidget( leftSplitter );
    split->addWidget( mainView );

    QList<int> sizeList;
    sizeList << 180 << 420 ;
    split->setSizes( sizeList );
    split->setStretchFactor( 0, 0 );
    split->setStretchFactor( 1, 3 );
    split->setCollapsible( 1, false );
    leftSplitter->setMaximumWidth( 250 );

    /* In case we want to keep the splitter information */
    // components shall never write there setting to a fixed location, may infer
    // with other uses of the same component...
    getSettings()->beginGroup("Playlist");
    split->restoreState( getSettings()->value("splitterSizes").toByteArray());
    leftSplitter->restoreState( getSettings()->value("leftSplitterGeometry").toByteArray() );
    getSettings()->endGroup();

    layout->addWidget( split, 1, 0, 1, -1 );

    setAcceptDrops( true );
    setWindowTitle( qtr( "Playlist" ) );
    setWindowRole( "vlc-playlist" );
    setWindowIcon( QApplication::windowIcon() );
}
コード例 #6
0
CapNJoinMenu::CapNJoinMenu(QWidget *parent)
    : QMenu(parent)
{
    QGridLayout *mainLayout = new QGridLayout();
    mainLayout->setMargin(2);

     // The cap group
    capGroup = new QButtonGroup(this);
    capGroup->setExclusive(true);

    QToolButton *button = 0;

    button = new QToolButton(this);
    button->setIcon(koIcon("stroke-cap-butt"));
    button->setCheckable(true);
    button->setToolTip(i18n("Butt cap"));
    capGroup->addButton(button, Qt::FlatCap);
    mainLayout->addWidget(button, 2, 0);

    button = new QToolButton(this);
    button->setIcon(koIcon("stroke-cap-round"));
    button->setCheckable(true);
    button->setToolTip(i18n("Round cap"));
    capGroup->addButton(button, Qt::RoundCap);
    mainLayout->addWidget(button, 2, 1);

    button = new QToolButton(this);
    button->setIcon(koIcon("stroke-cap-square"));
    button->setCheckable(true);
    button->setToolTip(i18n("Square cap"));
    capGroup->addButton(button, Qt::SquareCap);
    mainLayout->addWidget(button, 2, 2, Qt::AlignLeft);

    // The join group
    joinGroup = new QButtonGroup(this);
    joinGroup->setExclusive(true);

    button = new QToolButton(this);
    button->setIcon(koIcon("stroke-join-miter"));
    button->setCheckable(true);
    button->setToolTip(i18n("Miter join"));
    joinGroup->addButton(button, Qt::MiterJoin);
    mainLayout->addWidget(button, 3, 0);

    button = new QToolButton(this);
    button->setIcon(koIcon("stroke-join-round"));
    button->setCheckable(true);
    button->setToolTip(i18n("Round join"));
    joinGroup->addButton(button, Qt::RoundJoin);
    mainLayout->addWidget(button, 3, 1);

    button = new QToolButton(this);
    button->setIcon(koIcon("stroke-join-bevel"));
    button->setCheckable(true);
    button->setToolTip(i18n("Bevel join"));
    joinGroup->addButton(button, Qt::BevelJoin);
    mainLayout->addWidget(button, 3, 2, Qt::AlignLeft);

    // Miter limit
    // set min/max/step and value in points, then set actual unit
    miterLimit = new KoUnitDoubleSpinBox(this);
    miterLimit->setMinMaxStep(0.0, 1000.0, 0.5);
    miterLimit->setDecimals(2);
    miterLimit->setUnit(KoUnit(KoUnit::Point));
    miterLimit->setToolTip(i18n("Miter limit"));
    mainLayout->addWidget(miterLimit, 4, 0, 1, 3);

    mainLayout->setSizeConstraint(QLayout::SetMinAndMaxSize);
    setLayout(mainLayout);
}
コード例 #7
0
ファイル: PopupEditorWindow.cpp プロジェクト: Dessa/KVIrc
SinglePopupEditor::SinglePopupEditor(QWidget * par)
    : QWidget(par)
{
	m_pLastSelectedItem = nullptr;
	m_pContextPopup = new QMenu(this);
	m_pClipboard = nullptr;
	m_pTestPopup = nullptr;

	QGridLayout * g = new QGridLayout(this);
	g->setMargin(0);
	g->setSpacing(2);

	m_pNameEditor = new QLineEdit(this);
	m_pNameEditor->setToolTip(__tr2qs_ctx("Popup name", "editor"));

	g->addWidget(m_pNameEditor, 0, 0, 1, 2);

	m_pMenuButton = new QPushButton(__tr2qs_ctx("Test", "editor"), this);
	g->addWidget(m_pMenuButton, 0, 2);
	connect(m_pMenuButton, SIGNAL(clicked()), this, SLOT(testPopup()));
	QSplitter * spl = new QSplitter(Qt::Vertical, this);
	spl->setObjectName("popupeditor_vertical_splitter");
	spl->setChildrenCollapsible(false);

	m_pTreeWidget = new QTreeWidget(spl);
	m_pTreeWidget->setColumnCount(2);
	QStringList labels;
	labels << __tr2qs_ctx("Item", "editor") << __tr2qs_ctx("Type", "editor");
	m_pTreeWidget->setHeaderLabels(labels);
	m_pTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
	m_pTreeWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
	m_pTreeWidget->setAllColumnsShowFocus(true);
	m_pTreeWidget->setRootIsDecorated(true);
	m_pTreeWidget->header()->setSortIndicatorShown(false);
	m_pTreeWidget->setSortingEnabled(false);
	m_pTreeWidget->setContextMenuPolicy(Qt::CustomContextMenu);

	connect(m_pTreeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(selectionChanged()));
	connect(m_pTreeWidget, SIGNAL(customContextMenuRequested(const QPoint &)),
	    this, SLOT(customContextMenuRequested(const QPoint &)));

	m_pEditor = KviScriptEditor::createInstance(spl);

	g->addWidget(spl, 1, 0, 1, 3);

	QLabel * l = new QLabel(__tr2qs_ctx("Text:", "editor"), this);
	g->addWidget(l, 2, 0);

	m_pTextEditor = new QLineEdit(this);
	m_pTextEditor->setToolTip(
	    __tr2qs_ctx("<b>Visible text</b><br>May contain identifiers that will be evaluated at popup call time.<br>For labels, this text can contain also limited HTML tags.", "editor"));
	g->addWidget(m_pTextEditor, 2, 1, 1, 2);

	l = new QLabel(__tr2qs_ctx("Condition:", "editor"), this);
	l->setMargin(2);
	g->addWidget(l, 3, 0);

	m_pConditionEditor = new QLineEdit(this);
	m_pConditionEditor->setToolTip(
	    __tr2qs_ctx("<b>Boolean condition</b><br>Will be evaluated at popup call time in order to decide if this entry has to be shown.<br>An empty condition evaluates to true.", "editor"));
	g->addWidget(m_pConditionEditor, 3, 1, 1, 2);

	l = new QLabel(__tr2qs_ctx("Icon:", "editor"), this);
	l->setMargin(2);
	g->addWidget(l, 4, 0);

	m_pIconEditor = new QLineEdit(this);
	m_pIconEditor->setToolTip(
	    __tr2qs_ctx("<b>Icon identifier</b><br>May be an internal icon ID, an absolute path or a relative path.<br>Portable scripts should never use absolute paths.", "editor"));
	g->addWidget(m_pIconEditor, 4, 1, 1, 2);

	l = new QLabel(__tr2qs_ctx("External menu:", "editor"), this);
	l->setMargin(2);
	g->addWidget(l, 5, 0);

	m_pExtNameEditor = new QLineEdit(this);
	m_pExtNameEditor->setToolTip(
	    __tr2qs_ctx("<b>External menu name</b><br>This allows one to nest externally defined popup menus. The popup menu with the specified name will be looked up at menu setup time.", "editor"));
	g->addWidget(m_pExtNameEditor, 5, 1, 1, 2);

	l = new QLabel(__tr2qs_ctx("Item ID:", "editor"), this);
	l->setMargin(2);
	g->addWidget(l, 6, 0);

	m_pIdEditor = new QLineEdit(this);
	m_pIdEditor->setToolTip(
	    __tr2qs_ctx("<b>Item ID</b><br>This will allow you to use delpopupitem later.", "editor"));
	g->addWidget(m_pIdEditor, 6, 1, 1, 2);
	g->setColumnStretch(1, 1);
	g->setRowStretch(1, 1);
}
コード例 #8
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QPalette p;
    p.setColor(QPalette::Background, QColor("#97CBFF"));
    a.setPalette(p);
    //a.setAutoFillBackground(true);

    QLabel *window = new QLabel();
    window->setWindowTitle(TEXT_WINDOW_TITLE);

    QLabel *horCoordinate = new QLabel();
    QPixmap hCoord(PATH_HCOORD_IMG);
    horCoordinate->setPixmap(hCoord);
    horCoordinate->setMinimumSize(SIZE_COORDINATE_L, SIZE_COORDINATE_W);

    QLabel *verCoordinate = new QLabel();
    QPixmap vCoord(PATH_VCOORD_IMG);
    verCoordinate->setPixmap(vCoord);
    verCoordinate->setMinimumSize(SIZE_COORDINATE_W, SIZE_COORDINATE_L);

    Chessboard *chessboard = new Chessboard();
    QPixmap img(PATH_CHESSBORAD_IMG);
    chessboard->setPixmap(img.scaled(SIZE_CHESSBOARD, SIZE_CHESSBOARD));
    chessboard->setMinimumSize(SIZE_CHESSBOARD, SIZE_CHESSBOARD);

    QTextCodec *TradChineseCodec = QTextCodec::codecForName("Big5-ETen");
    QLabel *chessboardReadme = new QLabel(TradChineseCodec->toUnicode(
                                              "<center> <b>黑方</b> 滑鼠左鍵 |<b>  白方</b> 滑鼠右鍵 |<b>  清空</b> 滑鼠中鍵 </center>"));
    chessboardReadme->setAlignment(Qt::AlignHCenter);
    QLabel *funcReadme = new QLabel(TradChineseCodec->toUnicode(" <br> <br> <br> <br> <br><br> <br> <br> <br>"));

    QPushButton *clearBoard = new QPushButton(TradChineseCodec->toUnicode("清空棋盤"));
    QObject::connect(clearBoard, SIGNAL(clicked()), chessboard, SLOT(cleanChessboard()));
    QPushButton *readBoardData = new QPushButton(TradChineseCodec->toUnicode("讀取已存棋盤"));
    QObject::connect(readBoardData, SIGNAL(clicked()), chessboard, SLOT(readFromTxt()));
    QGridLayout *buttonLayout = new QGridLayout();
    buttonLayout->addWidget(readBoardData, 0, 0);
    buttonLayout->addWidget(clearBoard, 0, 1);

    QGridLayout *wholeChessboard = new QGridLayout;
    wholeChessboard->addWidget(horCoordinate, 0, 1);
    wholeChessboard->addWidget(verCoordinate, 1, 0);
    wholeChessboard->addWidget(chessboard, 1, 1);
    wholeChessboard->addWidget(chessboardReadme, 2, 0, 1, 2);
    wholeChessboard->addLayout(buttonLayout, 3, 0, 1, 2);
    wholeChessboard->addWidget(funcReadme, 4, 0, 1, 2);
    wholeChessboard->setMargin(20);


    FuncSet1 *findThreat = new FuncSet1();
    findThreat->setMinimumSize(SIZE_FUNC_W, SIZE_FUNC_H2);
    findThreat->setBrd(&(chessboard->boardData));

    FuncSet2 *threatSpaceSearch = new FuncSet2();
    threatSpaceSearch->setMinimumSize(SIZE_FUNC_W, SIZE_FUNC_H1);
    threatSpaceSearch->setBrd(&(chessboard->boardData));

    FuncSet3 *availableMove = new FuncSet3();
    availableMove->setMinimumSize(SIZE_FUNC_W, SIZE_FUNC_H2);
    availableMove->setBrd(&(chessboard->boardData));

    FuncSet4 *proofNumberSearch = new FuncSet4();
    proofNumberSearch->setMinimumSize(SIZE_FUNC_W, SIZE_FUNC_H1);
    proofNumberSearch->setBrd(&(chessboard->boardData));


    QGridLayout *wholeApp = new QGridLayout();
    wholeApp->addLayout(wholeChessboard,   0, 0, 3, 1);
    wholeApp->addWidget(availableMove,     0, 1);
    wholeApp->addWidget(findThreat,        1, 1);
    wholeApp->addWidget(threatSpaceSearch, 2, 1);
    wholeApp->addWidget(proofNumberSearch, 0, 2, 3, 1);
    wholeApp->setSpacing(15);


    QObject::connect(chessboard, SIGNAL(changeFuncsTurn(int)), availableMove,     SLOT(changeTurn(int)));
    QObject::connect(chessboard, SIGNAL(changeFuncsTurn(int)), findThreat,        SLOT(changeTurn(int)));
    QObject::connect(chessboard, SIGNAL(changeFuncsTurn(int)), threatSpaceSearch, SLOT(changeTurn(int)));
    QObject::connect(chessboard, SIGNAL(changeFuncsTurn(int)), proofNumberSearch, SLOT(changeTurn(int)));

    //wholeChessboard->addWidget(test, 4, 0, 1, 2);
    /*Paper *ya = new Paper();
    wholeApp->addWidget(ya, 2,2);

    BoardData orig;
    orig.printBoard(ya);
    orig.set(0,0,BLACK);
    orig.set(0,1,WHITE);
    orig.printBoard(ya);
    BoardData *tmp = new BoardData(&orig);
    tmp->set(1,1,BLACK);
    tmp->printBoard(ya);
    orig.printBoard(ya);*/

    window->setLayout(wholeApp);


    // 把其他method也寫進去

    // 以上先以"測試階段"的感覺去寫
    // last step: 整理code 還有output

    // threatspaceSearch 23

    window->show();
    return a.exec();
}
コード例 #9
0
ファイル: import_screen.cpp プロジェクト: cwarden/quasar
ImportScreen::ImportScreen(const CompanyDefn& company)
    : QMainWindow(0, "ImportScreen", WType_TopLevel | WDestructiveClose)
{
    _import = new DataImport(company, this);
    connect(_import, SIGNAL(message(int,QString,QString)),
	    SLOT(slotMessage(int,QString,QString)));

    QFrame* frame = new QFrame(this);
    QFrame* file = new QFrame(frame);

    QLabel* fileLabel = new QLabel(tr("Import File:"), file);
    _filePath = new LineEdit(file);
    _filePath->addPopup(Key_F9, tr("browse"));
    fileLabel->setBuddy(_filePath);
    connect(_filePath, SIGNAL(doPopup(QKeySequence)), SLOT(slotOpenFile()));

    QPushButton* browse = new QPushButton("...", file);
    browse->setFocusPolicy(ClickFocus);
    connect(browse, SIGNAL(clicked()), SLOT(slotOpenFile()));

    QGridLayout* fileGrid = new QGridLayout(file);
    fileGrid->setMargin(6);
    fileGrid->setSpacing(6);
    fileGrid->setColStretch(1, 1);
    fileGrid->addWidget(fileLabel, 0, 0);
    fileGrid->addWidget(_filePath, 0, 1);
    fileGrid->addWidget(browse, 0, 2);

    // TODO: add data types

    _log = new ListView(frame);
    _log->addNumberColumn(tr("Count"), 8);
    _log->addTextColumn(tr("Severity"), 12);
    _log->addTextColumn(tr("Data Type"), 16);
    _log->addTextColumn(tr("Data Name"), 20);
    _log->addTextColumn(tr("Message"), 30);
    _log->setAllColumnsShowFocus(true);
    _log->setShowSortIndicator(true);

    QFrame* buttons = new QFrame(frame);
    QPushButton* import = new QPushButton(tr("&Import"), buttons);
    QPushButton* close = new QPushButton(tr("&Close"), buttons);

    connect(import, SIGNAL(clicked()), SLOT(slotImport()));
    connect(close, SIGNAL(clicked()), SLOT(close()));

    QGridLayout* buttonGrid = new QGridLayout(buttons);
    buttonGrid->setSpacing(6);
    buttonGrid->setMargin(6);
    buttonGrid->setColStretch(0, 1);
    buttonGrid->addWidget(import, 0, 1);
    buttonGrid->addWidget(close, 0, 2);

    QGridLayout* grid = new QGridLayout(frame);
    grid->setSpacing(6);
    grid->setMargin(6);
    grid->setRowStretch(1, 1);
    grid->addWidget(file, 0, 0);
    grid->addWidget(_log, 1, 0);
    grid->addWidget(buttons, 2, 0);

    _filePath->setFocus();

    setCentralWidget(frame);
    setCaption(tr("Data Import: " + company.name()));
}
コード例 #10
0
ファイル: kdm-dlg.cpp プロジェクト: aarontc/kde-workspace
KDMDialogWidget::KDMDialogWidget(QWidget *parent)
    : QWidget(parent)
{
    QString wtstr;

    QGridLayout *grid = new QGridLayout(this);
    grid->setMargin(KDialog::marginHint());
    grid->setSpacing(KDialog::spacingHint());
    grid->setColumnStretch(1, 1);

    QHBoxLayout *hlay = new QHBoxLayout();
    hlay->setSpacing(KDialog::spacingHint());
    grid->addLayout(hlay, 0, 0, 1, 2);
    greetstr_lined = new KLineEdit(this);
    QLabel *label = new QLabel(i18n("&Greeting:"), this);
    label->setBuddy(greetstr_lined);
    hlay->addWidget(label);
    connect(greetstr_lined, SIGNAL(textChanged(QString)),
            SIGNAL(changed()));
    hlay->addWidget(greetstr_lined);
    wtstr = i18n(
        "<p>This is the \"headline\" for KDM's login window. You may want to "
        "put some nice greeting or information about the operating system here.</p>"
        "<p>KDM will substitute the following character pairs with the "
        "respective contents:</p>"
        "<ul>"
        "<li>%d -> current display</li>"
        "<li>%h -> host name, possibly with domain name</li>"
        "<li>%n -> node name, most probably the host name without domain name</li>"
        "<li>%s -> the operating system</li>"
        "<li>%r -> the operating system's version</li>"
        "<li>%m -> the machine (hardware) type</li>"
        "<li>%% -> a single %</li>"
        "</ul>");
    label->setWhatsThis(wtstr);
    greetstr_lined->setWhatsThis(wtstr);


    QGridLayout *hglay = new QGridLayout();
    hglay->setSpacing(KDialog::spacingHint());
    grid->addLayout(hglay, 1, 0);

    label = new QLabel(i18n("Logo area:"), this);
    hglay->addWidget(label, 0, 0);
    QVBoxLayout *vlay = new QVBoxLayout();
    vlay->setSpacing(KDialog::spacingHint());
    hglay->addLayout(vlay, 0, 1, 1, 2);
    noneRadio = new QRadioButton(i18nc("logo area", "&None"), this);
    clockRadio = new QRadioButton(i18n("Show cloc&k"), this);
    logoRadio = new QRadioButton(i18n("Sho&w logo"), this);
    QButtonGroup *buttonGroup = new QButtonGroup(this);
    connect(buttonGroup, SIGNAL(buttonClicked(int)),
            SLOT(slotAreaRadioClicked(int)));
    connect(buttonGroup, SIGNAL(buttonClicked(int)), SIGNAL(changed()));
    buttonGroup->addButton(noneRadio, KdmNone);
    buttonGroup->addButton(clockRadio, KdmClock);
    buttonGroup->addButton(logoRadio, KdmLogo);
    vlay->addWidget(noneRadio);
    vlay->addWidget(clockRadio);
    vlay->addWidget(logoRadio);
    wtstr = i18n("You can choose to display a custom logo (see below), a clock or no logo at all.");
    label->setWhatsThis(wtstr);
    noneRadio->setWhatsThis(wtstr);
    logoRadio->setWhatsThis(wtstr);
    clockRadio->setWhatsThis(wtstr);

    logoLabel = new QLabel(i18n("&Logo:"), this);
    logobutton = new QPushButton(this);
    logoLabel->setBuddy(logobutton);
    logobutton->setAutoDefault(false);
    logobutton->setAcceptDrops(true);
    logobutton->installEventFilter(this); // for drag and drop
    connect(logobutton, SIGNAL(clicked()), SLOT(slotLogoButtonClicked()));
    hglay->addWidget(logoLabel, 1, 0, Qt::AlignVCenter);
    hglay->addWidget(logobutton, 1, 1, Qt::AlignCenter);
    hglay->setRowMinimumHeight(1, 110);
    wtstr = i18n(
        "Click here to choose an image that KDM will display. "
        "You can also drag and drop an image onto this button "
        "(e.g. from Konqueror).");
    logoLabel->setWhatsThis(wtstr);
    logobutton->setWhatsThis(wtstr);


    vlay = new QVBoxLayout();
    grid->addLayout(vlay, 1, 1, 2, 1);
    vlay->setParent(grid);

    label = new QLabel(i18n("Dialog &position:"), this);
    vlay->addWidget(label);
    positioner = new Positioner(this);
    label->setBuddy(positioner);
    connect(positioner, SIGNAL(positionChanged()), SIGNAL(changed()));
    vlay->addWidget(positioner);

    grid->setRowStretch(3, 1);

}
コード例 #11
0
ファイル: palette.cpp プロジェクト: Conicer/pencil
Palette::Palette(Editor* editor) : QDockWidget(editor, Qt::Tool)
{
	this->editor = editor;
	
	QWidget* paletteContent = new QWidget();
	//paletteContent->setWindowFlags(Qt::FramelessWindowHint);
	
	sliderRed = new QSlider(Qt::Horizontal);
	sliderGreen = new QSlider(Qt::Horizontal);
	sliderBlue = new QSlider(Qt::Horizontal);
	sliderAlpha = new QSlider(Qt::Horizontal);
	sliderRed->setRange(0,255);
	sliderGreen->setRange(0,255);
	sliderBlue->setRange(0,255);
	sliderAlpha->setRange(0,255);
	QLabel* labelRed = new QLabel(tr("Red"));
	QLabel* labelGreen = new QLabel(tr("Green"));
	QLabel* labelBlue = new QLabel(tr("Blue"));
	QLabel* labelAlpha = new QLabel(tr("Alpha"));
	labelRed->setFont( QFont("Helvetica", 10) );
	labelGreen->setFont( QFont("Helvetica", 10) );
	labelBlue->setFont( QFont("Helvetica", 10) );
	labelAlpha->setFont( QFont("Helvetica", 10) );
	
	QGridLayout* sliderLayout = new QGridLayout();
	sliderLayout->setSpacing(3);
	sliderLayout->addWidget(labelRed, 0, 0);
	sliderLayout->addWidget(sliderRed, 0, 1);
	sliderLayout->addWidget(labelGreen, 1, 0);
	sliderLayout->addWidget(sliderGreen, 1, 1);
	sliderLayout->addWidget(labelBlue, 2, 0);
	sliderLayout->addWidget(sliderBlue, 2, 1);
	sliderLayout->addWidget(labelAlpha, 3, 0);
	sliderLayout->addWidget(sliderAlpha, 3, 1);
	sliderLayout->setMargin(10);
	sliderLayout->setSpacing(2);
	
	//QWidget* sliders = new QWidget();
	//sliders->setLayout(sliderLayout);
	//sliders->setFixedHeight(60);
	
	listOfColours = new QListWidget();
	
	QToolBar *buttons = new QToolBar();
	addButton = new QToolButton();
	removeButton = new QToolButton();
	addButton->setIcon(QIcon(":icons/add.png"));
	addButton->setToolTip("Add Colour");
	addButton->setFixedSize(30,30);
	removeButton->setIcon(QIcon(":icons/remove.png"));
	removeButton->setToolTip("Remove Colour");
	removeButton->setFixedSize(30,30);
	
	QLabel* spacer = new QLabel();
	spacer->setFixedWidth(10);
	
	colourSwatch = new QToolButton(); //QLabel();
	colourSwatch->setFixedSize( 40, 40 );
	QPixmap colourPixmap(30,30);
	colourPixmap.fill( Qt::black );
	colourSwatch->setIcon(QIcon(colourPixmap)); //colourSwatch->setPixmap(colourPixmap);
	/*QFrame* colourSwatchFrame = new QFrame();
	colourSwatchFrame->setFixedSize( 50, 50 );
	//colourSwatchFrame->setFrameStyle(QFrame::Panel | QFrame::Sunken);
	QVBoxLayout *colourSwatchLayout = new QVBoxLayout();
	colourSwatchLayout->addWidget(colourSwatch);
	colourSwatchFrame->setLayout(colourSwatchLayout);*/
	
	//QGridLayout *buttonLayout = new QGridLayout();
	buttons->addWidget(spacer);
	buttons->addWidget(colourSwatch);
	buttons->addWidget(addButton);
	buttons->addWidget(removeButton);
	//buttons->setFixedSize(100,34);
	//buttons->layout()->setMargin(0);
	//buttons->layout()->setSpacing(0);
	//buttonLayout->setMargin(0);
	//buttonLayout->setSpacing(0);
	//buttons->setLayout(buttonLayout);
	
	listOfColours->setFrameStyle(QFrame::Panel | QFrame::Sunken);
	listOfColours->setLineWidth(1);
	listOfColours->setFocusPolicy(Qt::NoFocus);
	//listOfColours->setMinimumWidth(100);
	
	QVBoxLayout *layout = new QVBoxLayout();
	layout->addLayout(sliderLayout);
	layout->addWidget(buttons);
	layout->addWidget(listOfColours);
	layout->setMargin(0);
	
	paletteContent->setLayout(layout);
	setWidget(paletteContent);
	
	#ifndef Q_WS_MAC
		setStyleSheet ("QToolBar { border: 0px none black; }");
	#endif

	//setFrameStyle(QFrame::Panel);
	//setWindowFlags(Qt::Tool);
	setWindowFlags(Qt::WindowStaysOnTopHint);
	//setWindowFlags(Qt::SubWindow);
	setFloating(true);
	//setAllowedAreas(Qt::NoDockWidgetArea);
	//setMinimumSize(100, 300);
	paletteContent->setFixedWidth(150);  /// otherwise the palette is naturally too wide. Someone please fix this.
	//setFloating(false);
	//setFixedWidth(130);
	
	//setGeometry(10,60,100, 300);
	//setFocusPolicy(Qt::NoFocus);
	//setWindowOpacity(0.7);
	setWindowTitle(tr("Colours"));
	
	connect(sliderRed, SIGNAL(sliderMoved(int)), this, SLOT(updateColour()));
	connect(sliderGreen, SIGNAL(sliderMoved(int)), this, SLOT(updateColour()));
	connect(sliderBlue, SIGNAL(sliderMoved(int)), this, SLOT(updateColour()));
	connect(sliderAlpha, SIGNAL(sliderMoved(int)), this, SLOT(updateColour()));
	
	connect(sliderRed, SIGNAL(sliderReleased()), this, SLOT(changeColour()));
	connect(sliderGreen, SIGNAL(sliderReleased()), this, SLOT(changeColour()));
	connect(sliderBlue, SIGNAL(sliderReleased()), this, SLOT(changeColour()));
	connect(sliderAlpha, SIGNAL(sliderReleased()), this, SLOT(changeColour()));

	connect(listOfColours, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(selectColour(QListWidgetItem *, QListWidgetItem *)));
	connect(listOfColours, SIGNAL(itemClicked ( QListWidgetItem *)), this, SLOT(selectAndApplyColour( QListWidgetItem *)));
	//connect(listOfColours, SIGNAL(itemDoubleClicked ( QListWidgetItem *)), this, SLOT(changeColour( QListWidgetItem *)));
	connect(listOfColours, SIGNAL(itemDoubleClicked ( QListWidgetItem *)), this, SLOT(changeColourName( QListWidgetItem *)));
	
	connect(addButton, SIGNAL(clicked()), this, SLOT(addClick()));
	connect(removeButton, SIGNAL(clicked()), this, SLOT(rmClick()));
	
	connect(colourSwatch, SIGNAL(clicked()), this, SLOT(colourSwatchClicked()));
	
	connect(this, SIGNAL(topLevelChanged(bool)), this, SLOT(closeIfDocked(bool)));
}
コード例 #12
0
void AssociationRolePage::constructWidget()
{
    // underlying roles and objects
    QString nameA = m_pAssociationWidget->roleName(Uml::RoleType::A);
    QString nameB = m_pAssociationWidget->roleName(Uml::RoleType::B);
    QString titleA = i18n("Role A Properties");
    QString titleB = i18n("Role B Properties");
    QString widgetNameA = m_pAssociationWidget->widgetForRole(Uml::RoleType::A)->name();
    QString widgetNameB = m_pAssociationWidget->widgetForRole(Uml::RoleType::B)->name();
    if(!widgetNameA.isEmpty())
        titleA.append(QLatin1String(" (") + widgetNameA + QLatin1Char(')'));
    if(!widgetNameB.isEmpty())
        titleB.append(QLatin1String(" (") + widgetNameB + QLatin1Char(')'));

    // general configuration of the GUI
    int margin = fontMetrics().height();

    QGridLayout * mainLayout = new QGridLayout(this);
    mainLayout->setSpacing(6);

    // group boxes for role, documentation properties
    QGroupBox *propsAGB = new QGroupBox(this);
    QGroupBox *propsBGB = new QGroupBox(this);
    QGroupBox *changeABG = new QGroupBox(i18n("Role A Changeability"), this);
    QGroupBox *changeBBG = new QGroupBox(i18n("Role B Changeability"), this);
    QGroupBox *docAGB = new QGroupBox(this);
    QGroupBox *docBGB = new QGroupBox(this);
    propsAGB->setTitle(titleA);
    propsBGB->setTitle(titleB);
    docAGB->setTitle(i18n("Documentation"));
    docBGB->setTitle(i18n("Documentation"));

    QGridLayout * propsALayout = new QGridLayout(propsAGB);
    propsALayout->setSpacing(6);
    propsALayout->setMargin(margin);

    QGridLayout * propsBLayout = new QGridLayout(propsBGB);
    propsBLayout->setSpacing(6);
    propsBLayout->setMargin(margin);

    QStringList multiplicities;
    multiplicities << QString()
                   << QLatin1String("1")
                   << QLatin1String("*")
                   << QLatin1String("1..*")
                   << QLatin1String("0..1");

    // Properties
    //

    // Rolename A
    QLabel *pRoleAL = NULL;
    Dialog_Utils::makeLabeledEditField(propsALayout, 0,
                                    pRoleAL, i18n("Rolename:"),
                                    m_pRoleALE, nameA);

    // Multi A
    QLabel *pMultiAL = NULL;
    pMultiAL = new QLabel(i18n("Multiplicity:"), propsAGB);
    m_pMultiACB = new KComboBox(propsAGB);
    m_pMultiACB->addItems(multiplicities);
    m_pMultiACB->setDuplicatesEnabled(false);
    m_pMultiACB->setEditable(true);

    QString multiA =  m_pAssociationWidget->multiplicity(Uml::RoleType::A);
    if (!multiA.isEmpty())
        m_pMultiACB->setEditText(multiA);

    propsALayout->addWidget(pMultiAL, 1, 0);
    propsALayout->addWidget(m_pMultiACB, 1, 1);

    m_visibilityWidgetA = new VisibilityEnumWidget(m_pAssociationWidget, Uml::RoleType::A, this);
    mainLayout->addWidget(m_visibilityWidgetA, 1, 0);

    // Changeability A
    QHBoxLayout * changeALayout = new QHBoxLayout(changeABG);
    changeALayout->setMargin(margin);

    m_ChangeableARB = new QRadioButton(i18nc("changeability for A is changeable", "Changeable"), changeABG);
    changeALayout->addWidget(m_ChangeableARB);

    m_FrozenARB = new QRadioButton(i18nc("changeability for A is frozen", "Frozen"), changeABG);
    changeALayout->addWidget(m_FrozenARB);

    m_AddOnlyARB = new QRadioButton(i18nc("changeability for A is add only", "Add only"), changeABG);
    changeALayout->addWidget(m_AddOnlyARB);

    switch (m_pAssociationWidget->changeability(Uml::RoleType::A)) {
    case Uml::Changeability::Changeable:
        m_ChangeableARB->setChecked(true);
        break;
    case Uml::Changeability::Frozen:
        m_FrozenARB->setChecked(true);
        break;
    default:
        m_AddOnlyARB->setChecked(true);
        break;
    }

    // Rolename B
    QLabel * pRoleBL = NULL;
    Dialog_Utils::makeLabeledEditField(propsBLayout, 0,
                                    pRoleBL, i18n("Rolename:"),
                                    m_pRoleBLE, nameB);

    // Multi B
    QLabel *pMultiBL = NULL;
    pMultiBL = new QLabel(i18n("Multiplicity:"), propsBGB);
    m_pMultiBCB = new KComboBox(propsBGB);
    m_pMultiBCB->addItems(multiplicities);
    m_pMultiBCB->setDuplicatesEnabled(false);
    m_pMultiBCB->setEditable(true);

    QString multiB =  m_pAssociationWidget->multiplicity(Uml::RoleType::B);
    if (!multiB.isEmpty())
        m_pMultiBCB->setEditText(multiB);

    propsBLayout->addWidget(pMultiBL, 1, 0);
    propsBLayout->addWidget(m_pMultiBCB, 1, 1);

    m_visibilityWidgetB = new VisibilityEnumWidget(m_pAssociationWidget, Uml::RoleType::B, this);
    mainLayout->addWidget(m_visibilityWidgetB, 1, 1);

    // Changeability B
    QHBoxLayout * changeBLayout = new QHBoxLayout(changeBBG);
    changeBLayout->setMargin(margin);

    m_ChangeableBRB = new QRadioButton(i18nc("changeability for B is changeable", "Changeable"), changeBBG);
    changeBLayout->addWidget(m_ChangeableBRB);

    m_FrozenBRB = new QRadioButton(i18nc("changeability for B is frozen", "Frozen"), changeBBG);
    changeBLayout->addWidget(m_FrozenBRB);

    m_AddOnlyBRB = new QRadioButton(i18nc("changeability for B is add only", "Add only"), changeBBG);
    changeBLayout->addWidget(m_AddOnlyBRB);

    switch (m_pAssociationWidget->changeability(Uml::RoleType::B)) {
    case Uml::Changeability::Changeable:
        m_ChangeableBRB->setChecked(true);
        break;
    case Uml::Changeability::Frozen:
        m_FrozenBRB->setChecked(true);
        break;
    default:
        m_AddOnlyBRB->setChecked(true);
        break;
    }

    // Documentation
    //

    // Document A
    QHBoxLayout * docALayout = new QHBoxLayout(docAGB);
    docALayout->setMargin(margin);
    m_docA = new KTextEdit(docAGB);
    docALayout->addWidget(m_docA);
    m_docA-> setText(m_pAssociationWidget->roleDocumentation(Uml::RoleType::A));
    // m_docA->setText("<<not implemented yet>>");
    // m_docA->setEnabled(false);
    m_docA->setLineWrapMode(QTextEdit::WidgetWidth);

    // Document B
    QHBoxLayout * docBLayout = new QHBoxLayout(docBGB);
    docBLayout->setMargin(margin);
    m_docB = new KTextEdit(docBGB);
    docBLayout->addWidget(m_docB);
    m_docB->setText(m_pAssociationWidget->roleDocumentation(Uml::RoleType::B));
    // m_docB->setEnabled(false);
    m_docB->setLineWrapMode(QTextEdit::WidgetWidth);

    // add group boxes to main layout
    mainLayout->addWidget(propsAGB, 0, 0);
    mainLayout->addWidget(changeABG, 2, 0);
    mainLayout->addWidget(docAGB, 3, 0);
    mainLayout->addWidget(propsBGB, 0, 1);
    mainLayout->addWidget(changeBBG, 2, 1);
    mainLayout->addWidget(docBGB, 3, 1);
}
コード例 #13
0
void ElogEntryI::customEvent(QCustomEvent* event) {
  KstELOGAttribStruct	attrib;
  ELOGAttribList* pAttribs;
  QSizePolicy sizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
  QGridLayout* topGrid;
  QGridLayout* grid;
  QLabel* label;
  QLineEdit* lineedit;
  QCheckBox* checkbox;
  QComboBox* combobox;
  QRadioButton* radio;
  QHButtonGroup* buttonGroup;
  QString strLabel;
  unsigned int i;
  unsigned int j;

  if( event->type() == KstELOGAttrsEvent ) {
    pAttribs = (ELOGAttribList*)event->data();
    _attribs = *pAttribs;

    delete _frameWidget;
    _frameWidget = 0L;

    topGrid = dynamic_cast<QGridLayout*>(frameAttrs->layout());
    if (topGrid) {
      topGrid->invalidate();
      _frameWidget = new QWidget(frameAttrs, "Frame Widget");
      if( _frameWidget != NULL ) {
        setEnabled( TRUE );

        topGrid->addWidget(_frameWidget, 0, 0);
        grid = new QGridLayout(_frameWidget, pAttribs->count(), 2);
        grid->setMargin(6);
        grid->setSpacing(5);

        for( i=0; i<_attribs.count(); i++ ) {
          attrib = _attribs[i];

          strLabel = attrib.attribName;
          if( attrib.bMandatory ) {
            strLabel += "*";
          }
          strLabel += ":";
          label = new QLabel( strLabel, _frameWidget );
          grid->addWidget( label, i, 0, Qt::AlignLeft);

          switch( attrib.type ) {
          case AttribTypeText:
            lineedit = new QLineEdit( _frameWidget );
            grid->addWidget( lineedit, i, 1);
            _attribs[i].pWidget = lineedit;
            break;

          case AttribTypeBool:
            checkbox = new QCheckBox( _frameWidget );
            grid->addWidget( checkbox, i, 1);
            _attribs[i].pWidget = checkbox;
            break;

          case AttribTypeCombo:
            combobox = new QComboBox( _frameWidget );
            grid->addWidget( combobox, i, 1);
            for( j=0; j<attrib.values.count(); j++ ) {
              combobox->insertItem( attrib.values[j], -1 );
            }
            if( !attrib.bMandatory ) {
              combobox->insertItem( "", -1 );
            }
            _attribs[i].pWidget = combobox;
            break;

          case AttribTypeRadio:
            buttonGroup = new QHButtonGroup( "", _frameWidget );
            buttonGroup->setSizePolicy( sizePolicy );
            buttonGroup->setRadioButtonExclusive( TRUE );
            buttonGroup->setAlignment( AlignLeft );
            buttonGroup->setInsideMargin( 0 );
            buttonGroup->setLineWidth( 0 );
            grid->addWidget( buttonGroup, i, 1 );
            for( j=0; j<attrib.values.count(); j++ ) {
              radio = new QRadioButton( attrib.values[j], buttonGroup );
              if( j == 0 ) {
                radio->setChecked( TRUE );
              }
            }
            _attribs[i].pWidget = buttonGroup;
            break;

          case AttribTypeCheck:
            buttonGroup = new QHButtonGroup( "", _frameWidget );
            buttonGroup->setSizePolicy( sizePolicy );
            buttonGroup->setAlignment( AlignLeft );
            buttonGroup->setInsideMargin( 0 );
            buttonGroup->setLineWidth( 0 );
            grid->addWidget( buttonGroup, i, 1 );
            for( j=0; j<attrib.values.count(); j++ ) {
              checkbox = new QCheckBox( attrib.values[j], buttonGroup );
            }
            _attribs[i].pWidget = buttonGroup;
            break;
          }
        }

        _frameWidget->show( );
        _frameWidget->resize(_frameWidget->sizeHint());
        frameAttrs->resize(frameAttrs->sizeHint());
        resize(sizeHint());

        loadSettings( );
        setSettings( );
      }
    }
  }
}
コード例 #14
0
/**
 *   Sets up the dialog.
 */
void UMLEntityAttributeDialog::setupDialog()
{
    int margin = fontMetrics().height();
    QFrame *frame = new QFrame(this);
    setMainWidget(frame);
    QVBoxLayout * mainLayout = new QVBoxLayout(frame);

    m_pValuesGB = new QGroupBox(i18n("General Properties"), frame);
    QGridLayout * valuesLayout = new QGridLayout(m_pValuesGB);
    valuesLayout->setMargin(margin);
    valuesLayout->setSpacing(10);

    m_pTypeL = new QLabel(i18n("&Type:"), m_pValuesGB);
    valuesLayout->addWidget(m_pTypeL, 0, 0);

    m_pTypeCB = new KComboBox(true, m_pValuesGB);
    valuesLayout->addWidget(m_pTypeCB, 0, 1);
    m_pTypeL->setBuddy(m_pTypeCB);

    Dialog_Utils::makeLabeledEditField(valuesLayout, 1,
                                    m_pNameL, i18nc("name of entity attribute", "&Name:"),
                                    m_pNameLE, m_pEntityAttribute->name());

    Dialog_Utils::makeLabeledEditField(valuesLayout, 2,
                                    m_pInitialL, i18n("&Default value:"),
                                    m_pInitialLE, m_pEntityAttribute->getInitialValue());

    m_stereotypeWidget = new UMLStereotypeWidget(m_pEntityAttribute);
    m_stereotypeWidget->addToLayout(valuesLayout, 3);

    Dialog_Utils::makeLabeledEditField(valuesLayout, 4,
                                    m_pValuesL, i18n("Length/Values:"),
                                    m_pValuesLE, m_pEntityAttribute->getValues());

    m_pAutoIncrementCB = new QCheckBox(i18n("&Auto increment"), m_pValuesGB);
    m_pAutoIncrementCB->setChecked(m_pEntityAttribute->getAutoIncrement());
    valuesLayout->addWidget(m_pAutoIncrementCB, 5, 0);

    m_pNullCB = new QCheckBox(i18n("Allow &null"), m_pValuesGB);
    m_pNullCB->setChecked(m_pEntityAttribute->getNull());
    valuesLayout->addWidget(m_pNullCB, 6, 0);

    // enable/disable isNull depending on the state of Auto Increment Check Box
    slotAutoIncrementStateChanged(m_pAutoIncrementCB->isChecked());

    m_pAttributesL = new QLabel(i18n("Attributes:"), m_pValuesGB);
    valuesLayout->addWidget(m_pAttributesL, 7, 0);

    m_pAttributesCB = new KComboBox(true, m_pValuesGB);
#if QT_VERSION < 0x050000
    m_pAttributesCB->setCompletionMode(KGlobalSettings::CompletionPopup);
#endif
    valuesLayout->addWidget(m_pAttributesCB, 7, 1);
    m_pTypeL->setBuddy(m_pAttributesCB);

    insertAttribute(m_pEntityAttribute->getAttributes());
    insertAttribute(QString::fromLatin1("binary"), m_pAttributesCB->count());
    insertAttribute(QString::fromLatin1("unsigned"), m_pAttributesCB->count());
    insertAttribute(QString::fromLatin1("unsigned zerofill"), m_pAttributesCB->count());

    mainLayout->addWidget(m_pValuesGB);

    m_pScopeGB = new QGroupBox(i18n("Indexing"), frame);
    QHBoxLayout* scopeLayout = new QHBoxLayout(m_pScopeGB);
    scopeLayout->setMargin(margin);

    m_pNoneRB = new QRadioButton(i18n("&Not Indexed"), m_pScopeGB);
    scopeLayout->addWidget(m_pNoneRB);

    /*
    m_pPublicRB = new QRadioButton(i18n("&Primary"), m_pScopeGB);
    scopeLayout->addWidget(m_pPublicRB);

    m_pProtectedRB = new QRadioButton(i18n("&Unique"), m_pScopeGB);
    scopeLayout->addWidget(m_pProtectedRB);
    */

    m_pPrivateRB = new QRadioButton(i18n("&Indexed"), m_pScopeGB);
    scopeLayout->addWidget(m_pPrivateRB);

    mainLayout->addWidget(m_pScopeGB);
    UMLEntityAttribute::DBIndex_Type scope = m_pEntityAttribute->indexType();

    /*
    if (scope == UMLEntityAttribute::Primary)
        m_pPublicRB->setChecked(true);
    else if(scope == UMLEntityAttribute::Unique)
        m_pProtectedRB->setChecked(true);
    else */

    if (scope == UMLEntityAttribute::Index)
        m_pPrivateRB->setChecked(true);
    else {
        m_pNoneRB->setChecked(true);
    }

    m_pTypeCB->setDuplicatesEnabled(false); // only allow one of each type in box
#if QT_VERSION < 0x050000
    m_pTypeCB->setCompletionMode(KGlobalSettings::CompletionPopup);
#endif
    insertTypesSorted(m_pEntityAttribute->getTypeName());

    m_pNameLE->setFocus();
    connect(m_pNameLE, SIGNAL(textChanged(QString)), SLOT(slotNameChanged(QString)));
    connect(m_pAutoIncrementCB, SIGNAL(clicked(bool)), this, SLOT(slotAutoIncrementStateChanged(bool)));
    slotNameChanged(m_pNameLE->text());
}
コード例 #15
0
WatchVector::WatchVector(QWidget *parent) 
    : WatchView(parent)
{
    int i;

    /* Setup GUI */
    setupUi(this);
    fMapping->setVisible(false);

    QGridLayout *gridLayout;
    gridLayout = new QGridLayout(fContent);
    gridLayout->setSpacing(0);
    gridLayout->setMargin(0);

    m_qScrollArea = new QScrollArea();
    m_qScrollArea->setBackgroundRole(QPalette::Dark);
    gridLayout->addWidget(m_qScrollArea);
    
    m_pImageView = new ImageView();
    m_qScrollArea->setWidget(m_pImageView);

	m_viewCenter[0] = -1;
	m_viewCenter[1] = -1;
	
    /* Initialize attachments */
    for (i=0; i<MAX_ATTACHMENTS; i++) {
        m_pData[i] = NULL;
        m_qName[i] = QString("NULL");
    }

    /* Initialize color mapping comboboxes */
    Mapping m;
    m.index = 0;
    m.type  = MAP_TYPE_BLACK;
    cbRed->addItem(QString("black"), 
                   QVariant(getIntFromMapping(m)));
    cbGreen->addItem(QString("black"),
                     QVariant(getIntFromMapping(m)));
    cbBlue->addItem(QString("black"),
                    QVariant(getIntFromMapping(m)));

	m.index = 1;
    m.type = MAP_TYPE_WHITE;
    cbRed->addItem(QString("red"), 
                   QVariant(getIntFromMapping(m)));
    cbGreen->addItem(QString("green"), 
                     QVariant(getIntFromMapping(m)));
    cbBlue->addItem(QString("blue"), 
                    QVariant(getIntFromMapping(m)));
                    
    cbRed->setCurrentIndex(0);
    cbGreen->setCurrentIndex(0);
    cbBlue->setCurrentIndex(0);

	/* initialize range mapping comboboxes */
	RangeMapping rm;
	rm.index = 0;
	rm.range = RANGE_MAP_DEFAULT;
    cbMapRed->addItem(QIcon(QString::fromUtf8(":/icons/icons/watch-red-solid_32.png")),
                      QString(""), 
                      QVariant(getIntFromRangeMapping(rm)));
    cbMapGreen->addItem(QIcon(QString::fromUtf8(":/icons/icons/watch-green-solid_32.png")),
                        QString(""), 
                        QVariant(getIntFromRangeMapping(rm)));
    cbMapBlue->addItem(QIcon(QString::fromUtf8(":/icons/icons/watch-blue-solid_32.png")),
                       QString(""), 
                       QVariant(getIntFromRangeMapping(rm)));
	rm.index = 1;
	rm.range = RANGE_MAP_POSITIVE;
    cbMapRed->addItem(QIcon(QString::fromUtf8(":/icons/icons/watch-red-positive_32.png")),
                      QString(""), 
                      QVariant(getIntFromRangeMapping(rm)));
    cbMapGreen->addItem(QIcon(QString::fromUtf8(":/icons/icons/watch-green-positive_32.png")),
                        QString(""), 
                        QVariant(getIntFromRangeMapping(rm)));
    cbMapBlue->addItem(QIcon(QString::fromUtf8(":/icons/icons/watch-blue-positive_32.png")),
                       QString(""), 
                       QVariant(getIntFromRangeMapping(rm)));
	rm.index = 2;
	rm.range = RANGE_MAP_NEGATIVE;
    cbMapRed->addItem(QIcon(QString::fromUtf8(":/icons/icons/watch-red-negative_32.png")),
                      QString(""), 
                      QVariant(getIntFromRangeMapping(rm)));
    cbMapGreen->addItem(QIcon(QString::fromUtf8(":/icons/icons/watch-green-negative_32.png")),
                        QString(""), 
                        QVariant(getIntFromRangeMapping(rm)));
    cbMapBlue->addItem(QIcon(QString::fromUtf8(":/icons/icons/watch-blue-negative_32.png")),
                       QString(""), 
                       QVariant(getIntFromRangeMapping(rm)));
	rm.index = 3;
	rm.range = RANGE_MAP_ABSOLUTE;
    cbMapRed->addItem(QIcon(QString::fromUtf8(":/icons/icons/watch-red-absolute_32.png")),
                      QString(""), 
                      QVariant(getIntFromRangeMapping(rm)));
    cbMapGreen->addItem(QIcon(QString::fromUtf8(":/icons/icons/watch-green-absolute_32.png")),
                        QString(""), 
                        QVariant(getIntFromRangeMapping(rm)));
    cbMapBlue->addItem(QIcon(QString::fromUtf8(":/icons/icons/watch-blue-absolute_32.png")),
                       QString(""), 
                       QVariant(getIntFromRangeMapping(rm)));
	
    cbMapRed->setCurrentIndex(0);
    cbMapGreen->setCurrentIndex(0);
    cbMapBlue->setCurrentIndex(0);

    /* Initialize member variables */
    m_bNeedsUpdate = true;
    m_nActiveMappings = 0;

    updateGUI();

	connect(m_pImageView, SIGNAL(mousePosChanged(int, int)),
	        this, SLOT(setMousePos(int, int)));
	connect(m_pImageView, SIGNAL(picked(int, int)),
	        this, SLOT(newSelection(int, int)));
	connect(m_pImageView, SIGNAL(viewCenterChanged(int, int)),
	        this, SLOT(newViewCenter(int, int)));

	m_pImageView->setFocusPolicy(Qt::StrongFocus);
	m_pImageView->setFocus();
}
コード例 #16
0
QGridLayout * Widget::createLayout(QWidget * parent) {
	QGridLayout * layout = new QGridLayout(parent);
	layout->setSpacing(0);
	layout->setMargin(0);
	return layout;
}
コード例 #17
0
KarbonStyleButtonBox::KarbonStyleButtonBox( QWidget* parent )
    : QWidget( parent ), d( new Private() )
{
    //setMinimumSize( 45, 70 );
    setContentsMargins( 0, 0, 0, 0 );

    QGridLayout * layout = new QGridLayout( this );
    d->group = new QButtonGroup( this );

    // The button for no fill
    QToolButton* button = new QToolButton( this );
    //button->setIcon( QPixmap( (const char **) buttonnone ) );
    button->setIcon( KIcon( "edit-delete" ) );
    button->setToolTip( i18nc( "No stroke or fill", "None" ) );
    d->group->addButton( button, None );

    // The button for solid fill
    button = new QToolButton( this );
    button->setIcon( QPixmap( (const char **) buttonsolid ) );
    button->setToolTip( i18nc( "Solid color stroke or fill", "Solid" ) );
    d->group->addButton( button, Solid );

    // The button for gradient fill
    button = new QToolButton( this );
    button->setIcon( QPixmap( (const char **) buttongradient ) );
    button->setToolTip( i18n( "Gradient" ) );
    d->group->addButton( button, Gradient );

    // The button for pattern fill
    button = new QToolButton( this );
    button->setIcon( QPixmap( (const char **) buttonpattern ) );
    button->setToolTip( i18n( "Pattern" ) );
    d->group->addButton( button, Pattern );

    // The button for even-odd fill rule
    button = new QToolButton( this );
    button->setIcon( QPixmap( (const char **) buttonevenodd ) );
    button->setToolTip( i18n( "Even-Odd Fill" ) );
    d->group->addButton( button, EvenOdd );

    // The button for winding fill-rule
    button = new QToolButton( this );
    button->setIcon( QPixmap( (const char **) buttonwinding ) );
    button->setToolTip( i18n( "Winding Fill" ) );
    d->group->addButton( button, Winding );

    int index = 1;
    for( int row = 0; row < d->rowCount; ++row )
    {
        for( int col = 0; col < d->columnCount; ++col )
        {
            layout->addWidget( d->group->button( index ), row, col );
            index = index<<1;
            if( index > Winding )
                break;
        }
        if( index > Winding )
            break;
    }
    
    layout->setMargin( 0 );
    layout->setSpacing( 1 );
    layout->setColumnStretch( 0, 1 );
    layout->setColumnStretch( 1, 1 );
    layout->setRowStretch( 3, 1 );

    connect( d->group, SIGNAL( buttonClicked( int ) ), this, SIGNAL( buttonPressed( int ) ) );
}
コード例 #18
0
ファイル: timeline.cpp プロジェクト: scribblemaniac/pencil
void TimeLine::initUI()
{
    Q_ASSERT(editor() != nullptr);

    setWindowTitle(tr("Timeline"));

    QWidget* timeLineContent = new QWidget(this);

    mLayerList = new TimeLineCells(this, editor(), TIMELINE_CELL_TYPE::Layers);
    mTracks = new TimeLineCells(this, editor(), TIMELINE_CELL_TYPE::Tracks);

    mHScrollbar = new QScrollBar(Qt::Horizontal);
    mVScrollbar = new QScrollBar(Qt::Vertical);
    mVScrollbar->setMinimum(0);
    mVScrollbar->setMaximum(1);
    mVScrollbar->setPageStep(1);

    QWidget* leftWidget = new QWidget();
    leftWidget->setMinimumWidth(120);
    QWidget* rightWidget = new QWidget();

    QWidget* leftToolBar = new QWidget();
    leftToolBar->setFixedHeight(30);
    QWidget* rightToolBar = new QWidget();
    rightToolBar->setFixedHeight(30);

    // --- left widget ---
    // --------- layer buttons ---------
    QToolBar* layerButtons = new QToolBar(this);
    QLabel* layerLabel = new QLabel(tr("Layers:"));
    layerLabel->setIndent(5);

    QToolButton* addLayerButton = new QToolButton(this);
    addLayerButton->setIcon(QIcon(":icons/add.png"));
    addLayerButton->setToolTip(tr("Add Layer"));
    addLayerButton->setFixedSize(24, 24);

    QToolButton* removeLayerButton = new QToolButton(this);
    removeLayerButton->setIcon(QIcon(":icons/remove.png"));
    removeLayerButton->setToolTip(tr("Remove Layer"));
    removeLayerButton->setFixedSize(24, 24);

    layerButtons->addWidget(layerLabel);
    layerButtons->addWidget(addLayerButton);
    layerButtons->addWidget(removeLayerButton);
    layerButtons->setFixedHeight(30);

    QHBoxLayout* leftToolBarLayout = new QHBoxLayout();
    leftToolBarLayout->setMargin(0);
    leftToolBarLayout->addWidget(layerButtons);
    leftToolBar->setLayout(leftToolBarLayout);

    QAction* newBitmapLayerAct = new QAction(QIcon(":icons/layer-bitmap.png"), tr("New Bitmap Layer"), this);
    QAction* newVectorLayerAct = new QAction(QIcon(":icons/layer-vector.png"), tr("New Vector Layer"), this);
    QAction* newSoundLayerAct = new QAction(QIcon(":icons/layer-sound.png"), tr("New Sound Layer"), this);
    QAction* newCameraLayerAct = new QAction(QIcon(":icons/layer-camera.png"), tr("New Camera Layer"), this);

    QMenu* layerMenu = new QMenu(tr("&Layer", "Timeline add-layer menu"), this);
    layerMenu->addAction(newBitmapLayerAct);
    layerMenu->addAction(newVectorLayerAct);
    layerMenu->addAction(newSoundLayerAct);
    layerMenu->addAction(newCameraLayerAct);
    addLayerButton->setMenu(layerMenu);
    addLayerButton->setPopupMode(QToolButton::InstantPopup);

    QGridLayout* leftLayout = new QGridLayout();
    leftLayout->addWidget(leftToolBar, 0, 0);
    leftLayout->addWidget(mLayerList, 1, 0);
    leftLayout->setMargin(0);
    leftLayout->setSpacing(0);
    leftWidget->setLayout(leftLayout);

    // --- right widget ---
    // --------- key buttons ---------
    QToolBar* timelineButtons = new QToolBar(this);
    QLabel* keyLabel = new QLabel(tr("Keys:"));
    keyLabel->setIndent(5);

    QToolButton* addKeyButton = new QToolButton(this);
    addKeyButton->setIcon(QIcon(":icons/add.png"));
    addKeyButton->setToolTip(tr("Add Frame"));
    addKeyButton->setFixedSize(24, 24);

    QToolButton* removeKeyButton = new QToolButton(this);
    removeKeyButton->setIcon(QIcon(":icons/remove.png"));
    removeKeyButton->setToolTip(tr("Remove Frame"));
    removeKeyButton->setFixedSize(24, 24);

    QToolButton* duplicateKeyButton = new QToolButton(this);
    duplicateKeyButton->setIcon(QIcon(":icons/controls/duplicate.png"));
    duplicateKeyButton->setToolTip(tr("Duplicate Frame"));
    duplicateKeyButton->setFixedSize(24, 24);

    QLabel* zoomLabel = new QLabel(tr("Zoom:"));
    zoomLabel->setIndent(5);

    QSlider* zoomSlider = new QSlider(this);
    zoomSlider->setRange(4, 40);
    zoomSlider->setFixedWidth(74);
    zoomSlider->setValue(mTracks->getFrameSize());
    zoomSlider->setToolTip(tr("Adjust frame width"));
    zoomSlider->setOrientation(Qt::Horizontal);

    QLabel* onionLabel = new QLabel(tr("Onion skin:"));

    QToolButton* onionTypeButton = new QToolButton(this);
    onionTypeButton->setIcon(QIcon(":icons/onion_type.png"));
    onionTypeButton->setToolTip(tr("Toggle match keyframes"));
    onionTypeButton->setFixedSize(24, 24);

    timelineButtons->addWidget(keyLabel);
    timelineButtons->addWidget(addKeyButton);
    timelineButtons->addWidget(removeKeyButton);
    timelineButtons->addWidget(duplicateKeyButton);
    timelineButtons->addSeparator();
    timelineButtons->addWidget(zoomLabel);
    timelineButtons->addWidget(zoomSlider);
    timelineButtons->addSeparator();
    timelineButtons->addWidget(onionLabel);
    timelineButtons->addWidget(onionTypeButton);
    timelineButtons->addSeparator();
    timelineButtons->setFixedHeight(30);

    // --------- Time controls ---------
    mTimeControls = new TimeControls(this);
    mTimeControls->setEditor(editor());
    mTimeControls->initUI();
    mTimeControls->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
    updateLength();

    QHBoxLayout* rightToolBarLayout = new QHBoxLayout();
    rightToolBarLayout->addWidget(timelineButtons);
    rightToolBarLayout->setAlignment(Qt::AlignLeft);
    rightToolBarLayout->addWidget(mTimeControls);
    rightToolBarLayout->setMargin(0);
    rightToolBarLayout->setSpacing(0);
    rightToolBar->setLayout(rightToolBarLayout);

    QGridLayout* rightLayout = new QGridLayout();
    rightLayout->addWidget(rightToolBar, 0, 0);
    rightLayout->addWidget(mTracks, 1, 0);
    rightLayout->setMargin(0);
    rightLayout->setSpacing(0);
    rightWidget->setLayout(rightLayout);

    // --- Splitter ---
    QSplitter* splitter = new QSplitter(this);
    splitter->addWidget(leftWidget);
    splitter->addWidget(rightWidget);
    splitter->setSizes(QList<int>() << 100 << 600);


    QGridLayout* lay = new QGridLayout();
    lay->addWidget(splitter, 0, 0);
    lay->addWidget(mVScrollbar, 0, 1);
    lay->addWidget(mHScrollbar, 1, 0);
    lay->setMargin(0);
    lay->setSpacing(0);
    timeLineContent->setLayout(lay);
    setWidget(timeLineContent);

    setWindowFlags(Qt::WindowStaysOnTopHint);

    connect(mHScrollbar, &QScrollBar::valueChanged, mTracks, &TimeLineCells::hScrollChange);
    connect(mTracks, &TimeLineCells::offsetChanged, mHScrollbar, &QScrollBar::setValue);
    connect(mVScrollbar, &QScrollBar::valueChanged, mTracks, &TimeLineCells::vScrollChange);
    connect(mVScrollbar, &QScrollBar::valueChanged, mLayerList, &TimeLineCells::vScrollChange);

    connect(splitter, &QSplitter::splitterMoved, this, &TimeLine::updateLength);

    connect(addKeyButton, &QToolButton::clicked, this, &TimeLine::addKeyClick);
    connect(removeKeyButton, &QToolButton::clicked, this, &TimeLine::removeKeyClick);
    connect(duplicateKeyButton, &QToolButton::clicked, this, &TimeLine::duplicateKeyClick);
    connect(zoomSlider, &QSlider::valueChanged, mTracks, &TimeLineCells::setFrameSize);
    connect(onionTypeButton, &QToolButton::clicked, this, &TimeLine::toogleAbsoluteOnionClick);

    connect(mTimeControls, &TimeControls::soundToggled, this, &TimeLine::soundClick);
    connect(mTimeControls, &TimeControls::fpsChanged, this, &TimeLine::fpsChanged);
    connect(mTimeControls, &TimeControls::fpsChanged, this, &TimeLine::updateLength);
    connect(mTimeControls, &TimeControls::playButtonTriggered, this, &TimeLine::playButtonTriggered);

    connect(newBitmapLayerAct, &QAction::triggered, this, &TimeLine::newBitmapLayer);
    connect(newVectorLayerAct, &QAction::triggered, this, &TimeLine::newVectorLayer);
    connect(newSoundLayerAct, &QAction::triggered, this, &TimeLine::newSoundLayer);
    connect(newCameraLayerAct, &QAction::triggered, this, &TimeLine::newCameraLayer);
    connect(removeLayerButton, &QPushButton::clicked, this, &TimeLine::deleteCurrentLayer);

    connect(mLayerList, &TimeLineCells::mouseMovedY, mLayerList, &TimeLineCells::setMouseMoveY);
    connect(mLayerList, &TimeLineCells::mouseMovedY, mTracks, &TimeLineCells::setMouseMoveY);
    connect(mTracks, &TimeLineCells::lengthChanged, this, &TimeLine::updateLength);

    connect(editor(), &Editor::currentFrameChanged, this, &TimeLine::updateFrame);

    LayerManager* layer = editor()->layers();
    connect(layer, &LayerManager::layerCountChanged, this, &TimeLine::updateLayerNumber);

    scrubbing = false;
}
コード例 #19
0
PropertiesScriptingWindow::PropertiesScriptingWindow() :
   LabeledSectionGroup(NULL),
   mpScriptingWindow(NULL)
{
   // General
   QWidget* pGeneralWidget = new QWidget(this);

   QLabel* pScrollLabel = new QLabel("Scroll Buffer:", pGeneralWidget);
   mpScrollSpin = new QSpinBox(this);
   mpScrollSpin->setMinimum(1);
   mpScrollSpin->setMaximum(1024);
   mpScrollSpin->setSingleStep(1);

   LabeledSection* pGeneralSection = new LabeledSection(pGeneralWidget, "General", this);

   QGridLayout* pGeneralGrid = new QGridLayout(pGeneralWidget);
   pGeneralGrid->setMargin(0);
   pGeneralGrid->setSpacing(5);
   pGeneralGrid->addWidget(pScrollLabel, 0, 0);
   pGeneralGrid->addWidget(mpScrollSpin, 0, 1, Qt::AlignLeft);
   pGeneralGrid->setRowStretch(1, 10);
   pGeneralGrid->setColumnStretch(1, 10);

   // Input text
   QWidget* pInputWidget = new QWidget(this);

   QStringList columnNames;
   columnNames.append("Command");
   columnNames.append("Color");

   QPushButton* pCommandFontButton = new QPushButton("Font...", pInputWidget);

   LabeledSection* pInputSection = new LabeledSection(pInputWidget, "Input Text", this);

   QVBoxLayout* pInputLayout = new QVBoxLayout(pInputWidget);
   pInputLayout->setMargin(0);
   pInputLayout->setSpacing(5);
   pInputLayout->addWidget(pCommandFontButton, 0, Qt::AlignLeft);

   // Output text
   QWidget* pOutputWidget = new QWidget(this);

   QLabel* pOutputColorLabel = new QLabel("Output Color:", pOutputWidget);
   mpOutputColorButton = new CustomColorButton(pOutputWidget);
   mpOutputColorButton->usePopupGrid(true);
   QLabel* pOutputFontLabel = new QLabel("Output Font:", pOutputWidget);
   QPushButton* pOutputFontButton = new QPushButton("Edit...", pOutputWidget);

   QLabel* pErrorColorLabel = new QLabel("Error Color:", pOutputWidget);
   mpErrorColorButton = new CustomColorButton(pOutputWidget);
   mpErrorColorButton->usePopupGrid(true);
   QLabel* pErrorFontLabel = new QLabel("Error Font:", pOutputWidget);
   QPushButton* pErrorFontButton = new QPushButton("Edit...", pOutputWidget);

   LabeledSection* pOutputSection = new LabeledSection(pOutputWidget, "Output Text", this);

   QGridLayout* pOutputGrid = new QGridLayout(pOutputWidget);
   pOutputGrid->setMargin(0);
   pOutputGrid->setSpacing(5);
   pOutputGrid->addWidget(pOutputColorLabel, 0, 0);
   pOutputGrid->addWidget(mpOutputColorButton, 0, 1, Qt::AlignLeft);
   pOutputGrid->addWidget(pOutputFontLabel, 1, 0);
   pOutputGrid->addWidget(pOutputFontButton, 1, 1, Qt::AlignLeft);
   pOutputGrid->setRowMinimumHeight(2, 15);
   pOutputGrid->addWidget(pErrorColorLabel, 3, 0);
   pOutputGrid->addWidget(mpErrorColorButton, 3, 1, Qt::AlignLeft);
   pOutputGrid->addWidget(pErrorFontLabel, 4, 0);
   pOutputGrid->addWidget(pErrorFontButton, 4, 1, Qt::AlignLeft);
   pOutputGrid->setRowStretch(5, 10);
   pOutputGrid->setColumnStretch(1, 10);

   // Initialization
   addSection(pGeneralSection);
   addSection(pInputSection);
   addSection(pOutputSection);
   addStretch(10);
   setSizeHint(450, 400);

   // Connections
   connect(pCommandFontButton, SIGNAL(clicked()), this, SLOT(setCommandFont()));
   connect(pOutputFontButton, SIGNAL(clicked()), this, SLOT(setOutputFont()));
   connect(pErrorFontButton, SIGNAL(clicked()), this, SLOT(setErrorFont()));
}
コード例 #20
0
// =============================================================================
ZoomAndPanToPointDlg::ZoomAndPanToPointDlg(RasterElement* pRaster, GeocoordType coordType, QWidget* parent) :
   QDialog(parent),
   mpLatitudeEdit(NULL),
   mpLongitudeEdit(NULL),
   mpZoneEdit(NULL),
   mpHemEdit(NULL),
   mCoordType(coordType),
   mpRaster(pRaster)
{
   setMinimumWidth(350);

   QGridLayout* pGrid = new QGridLayout(this);
   pGrid->setMargin(10);
   pGrid->setSpacing(5);

   QComboBox* pSelectCoordType = new QComboBox(this);

   switch(mCoordType)
   {
      case GEOCOORD_MGRS:
         pSelectCoordType->addItem("MGRS");
         break;
      case GEOCOORD_LATLON:
         pSelectCoordType->addItem("Latitude/Longitude");
         break;
      case GEOCOORD_UTM:
         pSelectCoordType->addItem("UTM");
         break;
      default:
         break;
   }
   pSelectCoordType->addItem("Pixel Coordinates");

   pGrid->addWidget(new QLabel("Pan based on:", this), 0, 0);
   pGrid->addWidget(pSelectCoordType, 1, 0, 1, 4, Qt::AlignLeft);

   QString caption = "Coordinate Locator";

   mpLatitudeLabel = new QLabel(this);
   mpLongitudeLabel = new QLabel(this);
   mpZoneLabel = new QLabel(this);
   mpHemisphereLabel = new QLabel(this);

   pGrid->addWidget(mpLatitudeLabel, 2, 0);
   pGrid->addWidget(mpLongitudeLabel, 2, 1);
   pGrid->addWidget(mpZoneLabel, 2, 2);
   pGrid->addWidget(mpHemisphereLabel, 2, 3);

   mpLatitudeEdit = new QLineEdit(this);
   mpLongitudeEdit = new QLineEdit(this);
   mpZoneEdit = new QLineEdit(this);
   mpHemEdit = new QLineEdit(this);

   pGrid->addWidget(mpLatitudeEdit, 3, 0);
   pGrid->addWidget(mpLongitudeEdit, 3, 1);
   pGrid->addWidget(mpZoneEdit, 3, 2);
   pGrid->addWidget(mpHemEdit, 3, 3);

   setWindowTitle(caption);

   if (mpLatitudeEdit != NULL)
   {
      VERIFYNR(connect(mpLatitudeEdit, SIGNAL(textChanged(const QString&)), this, SLOT(allowOk())));
      VERIFYNR(connect(mpLatitudeEdit, SIGNAL(editingFinished()), this, SLOT(latModified())));
   }
コード例 #21
0
ファイル: serverDialog.cpp プロジェクト: puzzleSEQ/client
ServerDialog::ServerDialog(QWidget * parent) :
	QDialog(parent),
	nameEdit(new QLineEdit),
	ipEdit(new QLineEdit),
	portEdit(new QLineEdit)
{
	loadServerData();

	// Create edits
	portEdit->setValidator(new QIntValidator(PortRange::Minimal, PortRange::Maximal));
    QGridLayout * editBoxLayout = new QGridLayout;
	QLabel * serverNameLabel = new QLabel(tr("Server name"));
	serverNameLabel->setBuddy(nameEdit);
	editBoxLayout->addWidget(serverNameLabel, 0, 0, Qt::AlignRight);
    editBoxLayout->addWidget(nameEdit, 0, 1);
	QLabel * ipAddressLabel = new QLabel(tr("IP address"));
	ipAddressLabel->setBuddy(ipEdit);
	editBoxLayout->addWidget(ipAddressLabel, 1, 0, Qt::AlignRight);
    editBoxLayout->addWidget(ipEdit, 1, 1);
	QLabel * portLabel = new QLabel(tr("Port"));
	portLabel->setBuddy(portEdit);
	editBoxLayout->addWidget(portLabel, 2, 0, Qt::AlignRight);
    editBoxLayout->addWidget(portEdit, 2, 1);
    editBoxLayout->setColumnStretch(0, 0);
    editBoxLayout->setColumnStretch(1, 1);
	QPushButton * newButton = new QPushButton(tr("&Add new"));
	QPushButton * saveButton = new QPushButton(tr("&Save"));
	QPushButton * deleteButton = new QPushButton(tr("&Delete"));
	newButton->setAutoDefault(false);
	saveButton->setAutoDefault(false);
	deleteButton->setAutoDefault(false);
	connect(newButton, SIGNAL(clicked()), this, SLOT(_InsertServerEntry()));
	connect(saveButton, SIGNAL(clicked()), this, SLOT(_SaveServerEntry()));
	connect(deleteButton, SIGNAL(clicked()), this, SLOT(_DeleteServerEntry()));
	QDialogButtonBox * editButtonBox = new QDialogButtonBox(Qt::Horizontal);
	editButtonBox->addButton(newButton, QDialogButtonBox::ActionRole);
	editButtonBox->addButton(saveButton, QDialogButtonBox::ActionRole);
	editButtonBox->addButton(deleteButton, QDialogButtonBox::ActionRole);
	editBoxLayout->addWidget(editButtonBox, 3, 0, 1, 2, Qt::AlignRight);
	// Extension group box
	QGroupBox * extensionGroupBox = new QGroupBox(tr("Edit server settings"));
	extensionGroupBox->setLayout(editBoxLayout);
	QHBoxLayout * tempLayout = new QHBoxLayout;
	tempLayout->setMargin(0);
	tempLayout->addWidget(extensionGroupBox);
	QWidget * extension = new QWidget;
	editBoxLayout->setMargin(0);
	extension->setLayout(tempLayout);


    // Create table
    QStringList labels;
	labels << "#" << "IP address" << "Port" << "Server name" << "Ready" ;
    table = new QTableWidget;
    table->setRowCount(_data.count());
    table->setColumnCount(labels.count());
	table->setHorizontalHeaderLabels(labels);
	table->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
	table->horizontalHeader()->setSectionResizeMode(_TableName, QHeaderView::Stretch);
    table->verticalHeader()->setVisible(false);
    table->setShowGrid(false);
    table->setEditTriggers(QAbstractItemView::NoEditTriggers);
    table->setSelectionBehavior(QAbstractItemView::SelectRows);
    table->setSelectionMode(QAbstractItemView::SingleSelection);
	table->setItemDelegate(new NoFocusRectangleDelegate());
	table->horizontalHeader()->setHighlightSections(false);


	// Insert data
	for(int i = 0; i < _data.count(); ++i) {
		insertTableItem(i);
	}
	table->resizeRowsToContents();

	//table->setStyleSheet("QHeaderView::section:checked { background-color: white; }");

    // Connect signal and slots
	connect(table, SIGNAL(currentCellChanged(int,int,int,int)), this, SLOT(tableRowChanged(int,int,int,int)));
	QPushButton * cancelButton = new QPushButton(tr("&Cancel"));
	QPushButton * connectButton = new QPushButton(tr("Co&nnect"));
	cancelButton->setAutoDefault(false);
	connectButton->setDefault(true);
	connect(connectButton, SIGNAL(clicked()), this, SLOT(_SelectServer()));
	connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
	connect(table, SIGNAL(cellDoubleClicked(int, int)), this, SLOT(_SelectServer(int,int)));
	QPushButton * showEditButton = new QPushButton(tr("&Show editor"));
	showEditButton->setCheckable(true);
	showEditButton->setAutoDefault(false);
	connect(showEditButton, SIGNAL(toggled(bool)), extension, SLOT(setVisible(bool)));
	QDialogButtonBox * connectButtonBox = new QDialogButtonBox(Qt::Horizontal);
	connectButtonBox->addButton(connectButton, QDialogButtonBox::ActionRole);
	connectButtonBox->addButton(showEditButton, QDialogButtonBox::ActionRole);
	connectButtonBox->addButton(cancelButton, QDialogButtonBox::ActionRole);



    // Combine layouts
    _horizontalLayout = new QVBoxLayout;
	_horizontalLayout->setMargin(2);
	_horizontalLayout->addSpacing(6);
    _horizontalLayout->addWidget(table, 1);
	_horizontalLayout->addWidget(extension, 0);
	_horizontalLayout->addWidget(connectButtonBox, 0, Qt::AlignCenter);
    setLayout(_horizontalLayout);

	extension->hide();
	setWindowTitle(tr("Select server"));
	if (table->rowCount() > 0) {
		table->selectRow(0);
	}

	// Adjust the size of QDialog
	int defaultRowHeight = table->horizontalHeader()->height();
	int defaultHeightOffset = 100;
	resize(table->width(), 5 * defaultRowHeight + defaultHeightOffset);
}
コード例 #22
0
SpellChecker::SpellChecker(QTextEdit* document, DictionaryRef& dictionary) :
	QDialog(document->parentWidget(), Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint),
	m_dictionary(dictionary),
	m_document(document),
	m_checked_blocks(1),
	m_total_blocks(document->document()->blockCount()),
	m_loop_available(true)
{
	setWindowTitle(tr("Check Spelling"));
	setWindowModality(Qt::WindowModal);
	setAttribute(Qt::WA_DeleteOnClose);

	// Create widgets
	m_context = new QTextEdit(this);
	m_context->setReadOnly(true);
	m_context->setTabStopWidth(50);
	QPushButton* add_button = new QPushButton(tr("&Add"), this);
	add_button->setAutoDefault(false);
	connect(add_button, SIGNAL(clicked()), this, SLOT(add()));
	QPushButton* ignore_button = new QPushButton(tr("&Ignore"), this);
	ignore_button->setAutoDefault(false);
	connect(ignore_button, SIGNAL(clicked()), this, SLOT(ignore()));
	QPushButton* ignore_all_button = new QPushButton(tr("I&gnore All"), this);
	ignore_all_button->setAutoDefault(false);
	connect(ignore_all_button, SIGNAL(clicked()), this, SLOT(ignoreAll()));

	m_suggestion = new QLineEdit(this);
	QPushButton* change_button = new QPushButton(tr("&Change"), this);
	change_button->setAutoDefault(false);
	connect(change_button, SIGNAL(clicked()), this, SLOT(change()));
	QPushButton* change_all_button = new QPushButton(tr("C&hange All"), this);
	change_all_button->setAutoDefault(false);
	connect(change_all_button, SIGNAL(clicked()), this, SLOT(changeAll()));
	m_suggestions = new QListWidget(this);
	connect(m_suggestions, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(suggestionChanged(QListWidgetItem*)));

	QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal, this);
	connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));

	// Lay out dialog
	QGridLayout* layout = new QGridLayout(this);
	layout->setMargin(12);
	layout->setSpacing(6);
	layout->setColumnMinimumWidth(2, 6);

	layout->addWidget(new QLabel(tr("Not in dictionary:"), this), 0, 0, 1, 2);
	layout->addWidget(m_context, 1, 0, 3, 2);
	layout->addWidget(add_button, 1, 3);
	layout->addWidget(ignore_button, 2, 3);
	layout->addWidget(ignore_all_button, 3, 3);

	layout->setRowMinimumHeight(4, 12);

	layout->addWidget(new QLabel(tr("Change to:"), this), 5, 0);
	layout->addWidget(m_suggestion, 5, 1);
	layout->addWidget(m_suggestions, 6, 0, 1, 2);
	layout->addWidget(change_button, 5, 3);
	layout->addWidget(change_all_button, 6, 3, Qt::AlignTop);

	layout->setRowMinimumHeight(7, 12);
	layout->addWidget(buttons, 8, 3);
}
コード例 #23
0
ファイル: KarbonView.cpp プロジェクト: JeremiasE/KFormula
KarbonView::KarbonView( KarbonPart* p, QWidget* parent )
    : KoView( p, parent ), KXMLGUIBuilder( shell() ), d( new Private( p ) )
{
    debugView("KarbonView::KarbonView");

    setComponentData( KarbonFactory::componentData(), true );

    setClientBuilder( this );

    if( !p->isReadWrite() )
        setXMLFile( QString::fromLatin1( "karbon_readonly.rc" ) );
    else
        setXMLFile( QString::fromLatin1( "karbon.rc" ) );

    const int viewMargin = 250;
    d->canvas = new KarbonCanvas( p );
    d->canvas->setParent( this );
    d->canvas->setDocumentViewMargin( viewMargin );
    connect( d->canvas->shapeManager()->selection(), SIGNAL( selectionChanged() ), 
             this, SLOT( selectionChanged() ) );

    d->canvasController = new KoCanvasController(this);
    d->canvasController->setMinimumSize( QSize(viewMargin+50,viewMargin+50) );
    d->canvasController->setCanvas(d->canvas);
    d->canvasController->setCanvasMode( KoCanvasController::Infinite );
    // always show srollbars which fixes some nasty infinite
    // recursion when scrollbars are disabled during resizing
    d->canvasController->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
    d->canvasController->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
    d->canvasController->show();

    // set up status bar message
    d->status = new QLabel( QString(), statusBar() );
    d->status->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
    d->status->setMinimumWidth( 300 );
    addStatusBarItem( d->status, 1 );
    connect( KoToolManager::instance(), SIGNAL(changedStatusText(const QString &)),
             d->status, SLOT(setText(const QString &)) );
    d->cursorCoords = new QLabel( QString(), statusBar() );
    d->cursorCoords->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
    d->cursorCoords->setMinimumWidth( 50 );
    addStatusBarItem( d->cursorCoords, 0 );

    // TODO maybe the zoomHandler should be a member of the view and not the canvas.
    // set up the zoom controller
    KarbonZoomController * zoomController = new KarbonZoomController( d->canvasController, actionCollection() );
    zoomController->setPageSize( d->part->document().pageSize() );
    addStatusBarItem( zoomController->zoomAction()->createWidget( statusBar() ), 0 );
    zoomController->setZoomMode( KoZoomMode::ZOOM_PAGE );
    connect( zoomController, SIGNAL(zoomedToSelection()), this, SLOT(zoomSelection()));
    connect( zoomController, SIGNAL(zoomedToAll()), this, SLOT(zoomDrawing()));
    
    KarbonSmallStylePreview * smallPreview = new KarbonSmallStylePreview( statusBar() );
    connect( smallPreview, SIGNAL(fillApplied()), this, SLOT(applyFillToSelection()) );
    connect( smallPreview, SIGNAL(strokeApplied()), this, SLOT(applyStrokeToSelection()) );
    addStatusBarItem( smallPreview, 0 );

    // layout:
    QGridLayout *layout = new QGridLayout();
    layout->setMargin(0);
    layout->addWidget(d->canvasController, 1, 1);

    initActions();

    unsigned int max = part()->maxRecentFiles();
    setNumberOfRecentFiles( max );

    // widgets:
    d->horizRuler = new KoRuler( this, Qt::Horizontal, d->canvas->viewConverter() );
    d->horizRuler->setShowMousePosition(true);
    d->horizRuler->setUnit(p->unit());
    d->horizRuler->setRightToLeft(false);
    d->horizRuler->setVisible(false);
    new KoRulerController( d->horizRuler, d->canvas->resourceProvider() );

    layout->addWidget( d->horizRuler, 0, 1 );
    connect( p, SIGNAL( unitChanged( KoUnit ) ), this, SLOT( updateUnit( KoUnit ) ) );

    d->vertRuler = new KoRuler( this, Qt::Vertical, d->canvas->viewConverter() );
    d->vertRuler->setShowMousePosition(true);
    d->vertRuler->setUnit(p->unit());
    d->vertRuler->setVisible(false);
    layout->addWidget( d->vertRuler, 1, 0 );

    connect( d->canvas, SIGNAL(documentOriginChanged( const QPoint &)), this, SLOT(pageOffsetChanged()));
    connect( d->canvasController, SIGNAL(canvasOffsetXChanged(int)), this, SLOT(pageOffsetChanged()));
    connect( d->canvasController, SIGNAL(canvasOffsetYChanged(int)), this, SLOT(pageOffsetChanged()));
    connect( d->canvasController, SIGNAL(canvasMousePositionChanged(const QPoint &)),
            this, SLOT(mousePositionChanged(const QPoint&)));
    connect( d->vertRuler, SIGNAL(guideLineCreated(Qt::Orientation,int)), 
             d->canvasController, SLOT( addGuideLine(Qt::Orientation,int) ) );
    connect( d->horizRuler, SIGNAL(guideLineCreated(Qt::Orientation,int)), 
             d->canvasController, SLOT( addGuideLine(Qt::Orientation,int) ) );

    updateRuler();

    if( shell() )
    {
        KoToolManager::instance()->addController( d->canvasController );
        KoToolManager::instance()->registerTools( actionCollection(), d->canvasController );
        // set the first layer active
        d->canvasController->canvas()->shapeManager()->selection()->setActiveLayer( part()->document().layers().first() );

        //Create Dockers
        createLayersTabDock();

        KoToolBoxFactory toolBoxFactory(d->canvasController, i18n( "Tools" ) );
        createDockWidget( &toolBoxFactory );

        KoDockerManager *dockerMng = dockerManager();
        if (!dockerMng) {
            dockerMng = new KoDockerManager(this);
            setDockerManager(dockerMng);
        }

        connect( d->canvasController, SIGNAL( toolOptionWidgetsChanged(const QMap<QString, QWidget *> &, KoView *) ),
             dockerMng, SLOT( newOptionWidgets(const  QMap<QString, QWidget *> &, KoView *) ) );

        KoToolManager::instance()->requestToolActivation( d->canvasController );

        bool b = d->showRulerAction->isChecked();
        d->horizRuler->setVisible( b );
        d->vertRuler->setVisible( b );
    }

    setLayout(layout);

    reorganizeGUI();

    setFocusPolicy(Qt::NoFocus);
}
コード例 #24
0
ファイル: DancingBarsSettings.cpp プロジェクト: KDE/ksysguard
DancingBarsSettings::DancingBarsSettings( QWidget* parent, const char* name )
  : KPageDialog( parent ), mModel( new SensorModel( this ) )
{
  setFaceType( Tabbed );
  setWindowTitle( i18n( "Edit BarGraph Preferences" ) );
  setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
  setObjectName( name );
  setModal( false );

  mModel->setHasLabel( true );

  // Range page
  QFrame *page = new QFrame( this );
  addPage( page, i18n( "Range" ) );
  QGridLayout *pageLayout = new QGridLayout( page );
  pageLayout->setMargin( 0 );

  QGroupBox *groupBox = new QGroupBox( i18n( "Title" ), page );
  QGridLayout *boxLayout = new QGridLayout;
  groupBox->setLayout( boxLayout );

  mTitle = new QLineEdit( groupBox );
  mTitle->setWhatsThis( i18n( "Enter the title of the display here." ) );
  boxLayout->addWidget( mTitle, 0, 0 );

  pageLayout->addWidget( groupBox, 0, 0 );

  groupBox = new QGroupBox( i18n( "Display Range" ), page );
  boxLayout = new QGridLayout;
  groupBox->setLayout( boxLayout );
  boxLayout->setColumnStretch( 2, 1 );

  QLabel *label = new QLabel( i18n( "Minimum value:" ), groupBox );
  boxLayout->addWidget( label, 0, 0 );

  mMinValue = new QDoubleSpinBox(groupBox);
  mMinValue->setRange(0, 10000);
  mMinValue->setSingleStep(0.5);
  mMinValue->setValue(0);
  mMinValue->setDecimals(2);
  mMinValue->setWhatsThis( i18n( "Enter the minimum value for the display here. If both values are 0, automatic range detection is enabled." ) );
  boxLayout->addWidget( mMinValue, 0, 1 );
  label->setBuddy( mMinValue );

  label = new QLabel( i18n( "Maximum value:" ), groupBox );
  boxLayout->addWidget( label, 0, 3 );

  mMaxValue = new QDoubleSpinBox( groupBox);
  mMaxValue->setRange(0, 100);
  mMaxValue->setSingleStep(0.5);
  mMaxValue->setValue(100);
  mMaxValue->setDecimals(2);
  mMaxValue->setWhatsThis( i18n( "Enter the maximum value for the display here. If both values are 0, automatic range detection is enabled." ) );
  boxLayout->addWidget( mMaxValue, 0, 4 );
  label->setBuddy( mMaxValue );

  pageLayout->addWidget( groupBox, 1, 0 );

  pageLayout->setRowStretch( 2, 1 );

  // Alarm page
  page = new QFrame( this );
  addPage( page, i18n( "Alarms" ) );
  pageLayout = new QGridLayout( page );
  pageLayout->setMargin( 0 );

  groupBox = new QGroupBox( i18n( "Alarm for Minimum Value" ), page );
  boxLayout = new QGridLayout;
  groupBox->setLayout( boxLayout );
  boxLayout->setColumnStretch( 1, 1 );

  mUseLowerLimit = new QCheckBox( i18n( "Enable alarm" ), groupBox );
  mUseLowerLimit->setWhatsThis( i18n( "Enable the minimum value alarm." ) );
  boxLayout->addWidget( mUseLowerLimit, 0, 0 );

  label = new QLabel( i18n( "Lower limit:" ), groupBox );
  boxLayout->addWidget( label, 0, 2 );

  mLowerLimit = new QDoubleSpinBox(groupBox);
  mLowerLimit->setRange(0, 100);
  mLowerLimit->setSingleStep(0.5);
  mLowerLimit->setValue(0);
  mLowerLimit->setDecimals(2);
  mLowerLimit->setEnabled( false );
  boxLayout->addWidget( mLowerLimit, 0, 3 );
  label->setBuddy( mLowerLimit );

  pageLayout->addWidget( groupBox, 0, 0 );

  groupBox = new QGroupBox( i18n( "Alarm for Maximum Value" ), page );
  boxLayout = new QGridLayout;
  groupBox->setLayout( boxLayout );
  boxLayout->setColumnStretch( 1, 1 );

  mUseUpperLimit = new QCheckBox( i18n( "Enable alarm" ), groupBox );
  mUseUpperLimit->setWhatsThis( i18n( "Enable the maximum value alarm." ) );
  boxLayout->addWidget( mUseUpperLimit, 0, 0 );

  label = new QLabel( i18n( "Upper limit:" ), groupBox );
  boxLayout->addWidget( label, 0, 2 );

  mUpperLimit = new QDoubleSpinBox( groupBox);
  mUpperLimit->setRange(0, 1000);
  mUpperLimit->setSingleStep(0.5);
  mUpperLimit->setDecimals(2);
  mUpperLimit->setEnabled( false );
  boxLayout->addWidget( mUpperLimit, 0, 3 );
  label->setBuddy( mUpperLimit );

  pageLayout->addWidget( groupBox, 1, 0 );

  pageLayout->setRowStretch( 2, 1 );

  // Look page
  page = new QFrame( this );
  addPage( page, i18nc( "@title:tab Appearance of the bar graph", "Look" ) );
  pageLayout = new QGridLayout( page );
  pageLayout->setMargin( 0 );

  label = new QLabel( i18n( "Normal bar color:" ), page );
  pageLayout->addWidget( label, 0, 0 );

  mForegroundColor = new KColorButton( page );
  pageLayout->addWidget( mForegroundColor, 0, 1 );
  label->setBuddy( mForegroundColor );

  label = new QLabel( i18n( "Out-of-range color:" ), page );
  pageLayout->addWidget( label, 1, 0 );

  mAlarmColor = new KColorButton( page );
  pageLayout->addWidget( mAlarmColor, 1, 1 );
  label->setBuddy( mAlarmColor );

  label = new QLabel( i18n( "Background color:" ), page );
  pageLayout->addWidget( label, 2, 0 );

  mBackgroundColor = new KColorButton( page );
  pageLayout->addWidget( mBackgroundColor, 2, 1 );
  label->setBuddy( mBackgroundColor );

  label = new QLabel( i18n( "Font size:" ), page );
  pageLayout->addWidget( label, 3, 0 );

  mFontSize = new QSpinBox( page );
  mFontSize->setValue( 9 );
  mFontSize->setWhatsThis( i18n( "This determines the size of the font used to print a label underneath the bars. Bars are automatically suppressed if text becomes too large, so it is advisable to use a small font size here." ) );
  pageLayout->addWidget( mFontSize, 3, 1 );
  label->setBuddy( mFontSize );

  pageLayout->setRowStretch( 4, 1 );

  // Sensor page
  page = new QFrame( this );
  addPage( page, i18n( "Sensors" ) );
  pageLayout = new QGridLayout( page );
  pageLayout->setMargin( 0 );
  pageLayout->setRowStretch( 2, 1 );

  mView = new QTreeView( page );
  mView->header()->setStretchLastSection( true );
  mView->setRootIsDecorated( false );
  mView->setItemsExpandable( false );
  mView->setModel( mModel );
  pageLayout->addWidget( mView, 0, 0, 3, 1);

  mEditButton = new QPushButton( i18n( "Edit..." ), page );
  mEditButton->setWhatsThis( i18n( "Push this button to configure the label." ) );
  pageLayout->addWidget( mEditButton, 0, 1 );

  mRemoveButton = new QPushButton( i18n( "Delete" ), page );
  mRemoveButton->setWhatsThis( i18n( "Push this button to delete the sensor." ) );
  pageLayout->addWidget( mRemoveButton, 1, 1 );

  connect(mUseLowerLimit, &QCheckBox::toggled, mLowerLimit, &QDoubleSpinBox::setEnabled);
  connect(mUseUpperLimit, &QCheckBox::toggled, mUpperLimit, &QDoubleSpinBox::setEnabled);
  connect(mEditButton, &QPushButton::clicked, this, &DancingBarsSettings::editSensor);
  connect(mRemoveButton, &QPushButton::clicked, this, &DancingBarsSettings::removeSensor);

  KAcceleratorManager::manage( this );

  mTitle->setFocus();
}
void
QvisPersistentParticlesWindow::CreateWindowContents()
{
    QGridLayout *mainLayout = new QGridLayout(0);
    topLayout->addLayout(mainLayout);

    QGroupBox * timeGroup = new QGroupBox(central);
    timeGroup->setTitle(tr("Time Slices"));
    topLayout->addWidget(timeGroup);

    QGridLayout *timeLayout = new QGridLayout(timeGroup);
    timeLayout->setMargin(5);
    timeLayout->setSpacing(10);

    // Start
    startPathTypeLabel = new QLabel(tr("Type of path"), central);
    timeLayout->addWidget(startPathTypeLabel,0,0);
    startPathType = new QWidget(central);
    startPathTypeButtonGroup= new QButtonGroup(startPathType);
    QHBoxLayout *startPathTypeLayout = new QHBoxLayout(startPathType);
    startPathTypeLayout->setMargin(0);
    startPathTypeLayout->setSpacing(10);

    QRadioButton *startPathTypePathTypeEnumAbsolute = new QRadioButton(tr("Absolute"), startPathType);
    startPathTypeButtonGroup->addButton(startPathTypePathTypeEnumAbsolute, 0);
    startPathTypeLayout->addWidget(startPathTypePathTypeEnumAbsolute);
    QRadioButton *startPathTypePathTypeEnumRelative = new QRadioButton(tr("Relative"), startPathType);
    startPathTypeButtonGroup->addButton(startPathTypePathTypeEnumRelative, 1);
    startPathTypeLayout->addWidget(startPathTypePathTypeEnumRelative);
    connect(startPathTypeButtonGroup, SIGNAL(buttonClicked(int)),
            this, SLOT(startPathTypeChanged(int)));
    timeLayout->addWidget(startPathType, 0,1);

    startIndexLabel = new QLabel(tr("Index of first time slice"), central);
    timeLayout->addWidget(startIndexLabel,1,0);
    startIndex = new QLineEdit(central);
    connect(startIndex, SIGNAL(returnPressed()),
            this, SLOT(startIndexProcessText()));
    timeLayout->addWidget(startIndex, 1,1);

    // Stop
    stopPathTypeLabel = new QLabel(tr("Type of path"), central);
    timeLayout->addWidget(stopPathTypeLabel,2,0);
    stopPathType = new QWidget(central);
    stopPathTypeButtonGroup= new QButtonGroup(stopPathType);
    QHBoxLayout *stopPathTypeLayout = new QHBoxLayout(stopPathType);
    stopPathTypeLayout->setMargin(0);
    stopPathTypeLayout->setSpacing(10);
    QRadioButton *stopPathTypePathTypeEnumAbsolute = new QRadioButton(tr("Absolute"), stopPathType);
    stopPathTypeButtonGroup->addButton(stopPathTypePathTypeEnumAbsolute, 0);
    stopPathTypeLayout->addWidget(stopPathTypePathTypeEnumAbsolute);
    QRadioButton *stopPathTypePathTypeEnumRelative = new QRadioButton(tr("Relative"), stopPathType);
    stopPathTypeButtonGroup->addButton(stopPathTypePathTypeEnumRelative, 1);
    stopPathTypeLayout->addWidget(stopPathTypePathTypeEnumRelative);
    connect(stopPathTypeButtonGroup, SIGNAL(buttonClicked(int)),
            this, SLOT(stopPathTypeChanged(int)));
    timeLayout->addWidget(stopPathType, 2,1);

    stopIndexLabel = new QLabel(tr("Index of last time slice"), central);
    timeLayout->addWidget(stopIndexLabel,3,0);
    stopIndex = new QLineEdit(central);
    connect(stopIndex, SIGNAL(returnPressed()),
            this, SLOT(stopIndexProcessText()));
    timeLayout->addWidget(stopIndex, 3,1);

    // Stride
    strideLabel = new QLabel(tr("Skip rate between time slices"), central);
    timeLayout->addWidget(strideLabel,4,0);
    stride = new QLineEdit(central);
    connect(stride, SIGNAL(returnPressed()),
            this, SLOT(strideProcessText()));
    timeLayout->addWidget(stride, 4,1);


    // Coordinate replacement
    QGroupBox * coordinateGroup = new QGroupBox(central);
    coordinateGroup->setTitle(tr("Coordinate replacement"));
    topLayout->addWidget(coordinateGroup);

    QGridLayout *coordinateLayout = new QGridLayout(coordinateGroup);
    coordinateLayout->setMargin(5);
    coordinateLayout->setSpacing(10);


    traceVariableXLabel = new QLabel(tr("X-Coordinate"), central);
    coordinateLayout->addWidget(traceVariableXLabel,1,0);
    int traceVariableXMask = QvisVariableButton::Scalars;
    traceVariableX = new QvisVariableButton(true, true, true, traceVariableXMask, central);
    connect(traceVariableX, SIGNAL(activated(const QString&)),
            this, SLOT(traceVariableXChanged(const QString&)));
    coordinateLayout->addWidget(traceVariableX, 1,1);

    traceVariableYLabel = new QLabel(tr("Y-Coordinate"), central);
    coordinateLayout->addWidget(traceVariableYLabel,2,0);
    int traceVariableYMask = QvisVariableButton::Scalars;
    traceVariableY = new QvisVariableButton(true, true, true, traceVariableYMask, central);
    connect(traceVariableY, SIGNAL(activated(const QString&)),
            this, SLOT(traceVariableYChanged(const QString&)));
    coordinateLayout->addWidget(traceVariableY, 2,1);

    traceVariableZLabel = new QLabel(tr("Z-Coordinate"), central);
    coordinateLayout->addWidget(traceVariableZLabel,3,0);
    int traceVariableZMask = QvisVariableButton::Scalars;
    traceVariableZ = new QvisVariableButton(true, true, true, traceVariableZMask, central);
    connect(traceVariableZ, SIGNAL(activated(const QString&)),
            this, SLOT(traceVariableZChanged(const QString&)));
    coordinateLayout->addWidget(traceVariableZ, 3,1);


    QGroupBox * connectionsGroup = new QGroupBox(central);
    connectionsGroup->setTitle(tr("Connect particles"));
    topLayout->addWidget(connectionsGroup);

    QGridLayout *connectionsLayout = new QGridLayout(connectionsGroup);
    connectionsLayout->setMargin(5);
    connectionsLayout->setSpacing(10);


    connectParticles = new QCheckBox(tr("Connect particles"), central);
    connect(connectParticles, SIGNAL(toggled(bool)),
            this, SLOT(connectParticlesChanged(bool)));
    connectionsLayout->addWidget(connectParticles, 0,0);

    showPoints = new QCheckBox(tr("Show points"), central);
    connect(showPoints, SIGNAL(toggled(bool)),
            this, SLOT(showPointsChanged(bool)));
    connectionsLayout->addWidget(showPoints, 0,1);

    indexVariableLabel = new QLabel(tr("Index variable"), central);
    connectionsLayout->addWidget(indexVariableLabel,1,0);
    int indexVariableMask = QvisVariableButton::Scalars;
    indexVariable = new QvisVariableButton(true, true, true, indexVariableMask, central);
    connect(indexVariable, SIGNAL(activated(const QString&)),
            this, SLOT(indexVariableChanged(const QString&)));
    connectionsLayout->addWidget(indexVariable, 1,1);
}
コード例 #26
0
ファイル: model_edit.cpp プロジェクト: cwarden/quasar
void
ModelEdit::createWidgets()
{
    setCaption("Model Edit");
    menuBar();

    QFrame* main = new QFrame(this);
    QVBox* body = new QVBox(main);
    QFrame* top = new QFrame(body);
    QVBox* right = new QVBox(main);

    QLabel* versionLabel = new QLabel("&Version:", top);
    _version = new LineEdit(top);
    versionLabel->setBuddy(_version);

    QLabel* descLabel = new QLabel("&Description:", top);
    _desc = new MultiLineEdit(top);
    descLabel->setBuddy(_desc);

    QLabel* fromLabel = new QLabel("&From:", top);
    _from = new LineEdit(top);
    fromLabel->setBuddy(_from);

    QGridLayout* topGrid = new QGridLayout(top);
    topGrid->setSpacing(3);
    topGrid->setMargin(3);
    topGrid->setRowStretch(2, 1);
    topGrid->setColStretch(1, 1);
    topGrid->addWidget(versionLabel, 0, 0);
    topGrid->addWidget(_version, 0, 1, AlignLeft | AlignVCenter);
    topGrid->addWidget(descLabel, 1, 0);
    topGrid->addMultiCellWidget(_desc, 1, 2, 1, 1);
    topGrid->addWidget(fromLabel, 3, 0);
    topGrid->addWidget(_from, 3, 1, AlignLeft | AlignVCenter);

    QTabWidget* tabs = new QTabWidget(body);
    QVBox* objects = new QVBox(tabs);
    QVBox* updates = new QVBox(tabs);
    tabs->addTab(objects, tr("Objects"));
    tabs->addTab(updates, tr("Updates"));

    _objects = new ListView(objects);
    _objects->setAllColumnsShowFocus(true);
    _objects->setShowSortIndicator(true);
    _objects->addTextColumn("Name", 20);
    _objects->addTextColumn("Number", 10);
    _objects->addTextColumn("Description", 40);

    QHBox* objectCmds = new QHBox(objects);
    QPushButton* addObject = new QPushButton("Add Object", objectCmds);
    QPushButton* editObject = new QPushButton("Edit Object", objectCmds);
    QPushButton* removeObject = new QPushButton("Remove Object", objectCmds);

    _updates = new ListView(updates);
    _updates->setAllColumnsShowFocus(true);
    _updates->setShowSortIndicator(true);
    _updates->addTextColumn("Number", 10);
    _updates->addTextColumn("Description", 60);

    QHBox* updateCmds = new QHBox(updates);
    QPushButton* addUpdate = new QPushButton("Add Update", updateCmds);
    QPushButton* editUpdate = new QPushButton("Edit Update", updateCmds);
    QPushButton* removeUpdate = new QPushButton("Remove Update", updateCmds);

    QPushButton* ok = new QPushButton("&Ok", right);
    QPushButton* reset = new QPushButton("&Reset", right);
    QPushButton* cancel = new QPushButton("&Cancel", right);

    QGridLayout* grid = new QGridLayout(main);
    grid->setSpacing(3);
    grid->setMargin(3);
    grid->setColStretch(0, 1);
    grid->addWidget(body, 0, 0);
    grid->addWidget(right, 0, 1, AlignTop | AlignLeft);

    connect(ok, SIGNAL(clicked()), this, SLOT(slotOk()));
    connect(reset, SIGNAL(clicked()), this, SLOT(slotReset()));
    connect(cancel, SIGNAL(clicked()), this, SLOT(slotCancel()));
    connect(addObject, SIGNAL(clicked()), this, SLOT(slotAddObject()));
    connect(editObject, SIGNAL(clicked()), this, SLOT(slotEditObject()));
    connect(removeObject, SIGNAL(clicked()), this, SLOT(slotRemoveObject()));
    connect(_objects, SIGNAL(doubleClicked(QListViewItem*)), this,
	    SLOT(slotEditObject()));
    connect(addUpdate, SIGNAL(clicked()), this, SLOT(slotAddObject()));
    connect(editUpdate, SIGNAL(clicked()), this, SLOT(slotEditObject()));
    connect(removeUpdate, SIGNAL(clicked()), this, SLOT(slotRemoveObject()));
    connect(_updates, SIGNAL(doubleClicked(QListViewItem*)), this,
	    SLOT(slotEditUpdate()));

    setCentralWidget(main);

    QPopupMenu* file = new QPopupMenu(this);
    file->insertItem(tr("&Ok"), this, SLOT(slotOk()));
    file->insertItem(tr("&Reset"), this, SLOT(slotReset()));
    file->insertSeparator();
    file->insertItem(tr("&Cancel"), this, SLOT(slotCancel()), ALT+Key_Q);
    menuBar()->insertItem(tr("&File"), file);
}
コード例 #27
0
LayoutDlg::LayoutDlg(QWidget *parent, Qt::WindowFlags f)
        : QDialog(parent,f)
{
    setWindowTitle(tr("User Infomation"));
    
    // create 
    label1 = new QLabel(tr("User Name:"));
    label2 = new QLabel(tr("Name:"));
    label3 = new QLabel(tr("Sex"));
    label4 = new QLabel(tr("Department:"));
    label5 = new QLabel(tr("Age:"));
    labelOther = new QLabel(tr("Remark"));
    labelOther->setFrameStyle(QFrame::Panel|QFrame::Sunken);  
    lineEditUser = new QLineEdit();
    lineEditName = new QLineEdit();
    comboBoxSex = new QComboBox();
    comboBoxSex->insertItem(0,tr("Female"));
    comboBoxSex->insertItem(1,tr("Male"));
    textEditDepartment = new QTextEdit();
    lineEditAge = new QLineEdit();

    label7 = new QLabel(tr("Head"));
    labelIcon = new QLabel();
    QPixmap icon(":/images/icon.png");
    labelIcon->resize(icon.width(),icon.height());
    labelIcon->setPixmap(icon);
    pushButtonIcon = new QPushButton();
    pushButtonIcon->setText(tr("Change"));
    QHBoxLayout *hLayout = new QHBoxLayout;
    hLayout->setSpacing(20);
    hLayout->addWidget(label7);
    hLayout->addWidget(labelIcon);
    hLayout->addWidget(pushButtonIcon);
    
    label6 = new QLabel(tr("Individual:"));
    textEditDisc = new QTextEdit();
    
    pushButtonOK = new QPushButton(tr("OK"));
    pushButtonExit = new QPushButton(tr("Cancel"));
    
    //  Lay out
    // left layout -- is a grid layout
    QGridLayout * leftLayout = new QGridLayout();

    int labelCol = 0;
    int contentCol = 1;

    leftLayout->addWidget(label1,0,labelCol);		// user name row
    leftLayout->addWidget(lineEditUser,0,contentCol);
    
    leftLayout->addWidget(label2,1,labelCol);		// name row
    leftLayout->addWidget(lineEditName,1,contentCol);
    
    leftLayout->addWidget(label3,2,labelCol);		// sex row
    leftLayout->addWidget(comboBoxSex,2,contentCol);
    
    leftLayout->addWidget(label4,3,labelCol,Qt::AlignTop);  // department row
    leftLayout->addWidget(textEditDepartment,3,contentCol);

    leftLayout->addWidget(label5,4,labelCol);		// age row
    leftLayout->addWidget(lineEditAge,4,contentCol);
    
    leftLayout->addWidget(labelOther,5,labelCol,1,2);		// other

    leftLayout->setColumnStretch(0,1);
    leftLayout->setColumnStretch(1,3);
  
    // right layout -- is a vBoxLayout
    QVBoxLayout *rightLayout = new QVBoxLayout();
    rightLayout->setMargin(10);
    rightLayout->addLayout(hLayout);
    rightLayout->addWidget(label6);
    rightLayout->addWidget(textEditDisc);
    
    // buttom layout -- is a hBoxLayout
    QHBoxLayout * bottomLayout = new QHBoxLayout();
    bottomLayout->addStretch();
    bottomLayout->addWidget(pushButtonOK); 
    bottomLayout->addWidget(pushButtonExit);

    // main layout -- is a GridLayout
    QGridLayout * mainLayout = new QGridLayout(this);
    mainLayout->setMargin(15);
    mainLayout->setSpacing(10);
    mainLayout->addLayout(leftLayout,0,0);
    mainLayout->addLayout(rightLayout,0,1);
    mainLayout->addLayout(bottomLayout,1,0,1,2);
    mainLayout->setSizeConstraint(QLayout::SetFixedSize);
    
    connect(pushButtonExit,SIGNAL(clicked()),this,SLOT(reject()));
}
コード例 #28
0
ファイル: menubarpopup.cpp プロジェクト: CroW-CZ/opentoonz
MenuBarPopup::MenuBarPopup(Room* room)
	: Dialog(TApp::instance()->getMainWindow(), true, false, "CustomizeMenuBar")
{
	setWindowTitle(tr("Customize Menu Bar of Room \"%1\"").arg(room->getName()));
	
	/*- get menubar setting file path -*/
	std::string mbFileName = room->getPath().getName() + "_menubar.xml";
	TFilePath mbPath = ToonzFolder::getMyModuleDir() + mbFileName;
	
	m_commandListTree = new CommandListTree(this);
	m_menuBarTree = new MenuBarTree(mbPath, this);

	QPushButton *okBtn = new QPushButton(tr("OK"), this);
	QPushButton *cancelBtn = new QPushButton(tr("Cancel"), this);

	okBtn->setFocusPolicy(Qt::NoFocus);
	cancelBtn->setFocusPolicy(Qt::NoFocus);

	QLabel* menuBarLabel = new QLabel(tr("%1 Menu Bar").arg(room->getName()), this);
	QLabel* menuItemListLabel = new QLabel(tr("Menu Items"), this);
		
	QFont f("Arial", 15, QFont::Bold);
	menuBarLabel->setFont(f);
	menuItemListLabel->setFont(f);

	QLabel* noticeLabel = new QLabel(tr("N.B. If you put unique title to submenu, it may not be translated to another language.\nN.B. Duplicated commands will be ignored. Only the last one will appear in the menu bar."),this);
	QFont nf("Arial", 9, QFont::Normal);
	nf.setItalic(true);
	noticeLabel->setFont(nf);

	//--- layout
	QVBoxLayout* mainLay = new QVBoxLayout();
	m_topLayout->setMargin(0);
	m_topLayout->setSpacing(0);
	{
		QGridLayout* mainUILay = new QGridLayout();
		mainUILay->setMargin(5);
		mainUILay->setHorizontalSpacing(8);
		mainUILay->setVerticalSpacing(5);
		{
			mainUILay->addWidget(menuBarLabel, 0, 0);
			mainUILay->addWidget(menuItemListLabel, 0, 1);
			mainUILay->addWidget(m_menuBarTree, 1, 0);
			mainUILay->addWidget(m_commandListTree, 1, 1);

			mainUILay->addWidget(noticeLabel, 2, 0, 1, 2);
		}
		mainUILay->setRowStretch(0, 0);
		mainUILay->setRowStretch(1, 1);
		mainUILay->setRowStretch(2, 0);
		mainUILay->setColumnStretch(0, 1);
		mainUILay->setColumnStretch(1, 1);

		m_topLayout->addLayout(mainUILay, 1);
	}
		
	m_buttonLayout->setMargin(0);
	m_buttonLayout->setSpacing(30);
	{
		m_buttonLayout->addStretch(1);
		m_buttonLayout->addWidget(okBtn, 0);
		m_buttonLayout->addWidget(cancelBtn, 0);
		m_buttonLayout->addStretch(1);
	}

	//--- signal/slot connections

	bool ret = connect(okBtn, SIGNAL(clicked()), this, SLOT(onOkPressed()));
	ret = ret && connect(cancelBtn, SIGNAL(clicked()), this, SLOT(reject()));
	assert(ret);
}
コード例 #29
0
void XXPortSelectDialog::initGUI()
{
  QWidget *page = new QWidget( this );
  setMainWidget( page );

  QVBoxLayout *topLayout = new QVBoxLayout( page );
  topLayout->setSpacing( KDialog::spacingHint() );
  topLayout->setMargin( 0 );

  QLabel *label = new QLabel( i18n( "Which contacts do you want to export?" ), page );
  topLayout->addWidget( label );

  mButtonGroup = new QGroupBox( i18nc( "@title:group Selection of contacts that must be exported", "Selection" ), page );
  QGridLayout *groupLayout = new QGridLayout();
  groupLayout->setSpacing( KDialog::spacingHint() );
  groupLayout->setMargin( KDialog::marginHint() );
  groupLayout->setAlignment( Qt::AlignTop );
  mButtonGroup->setLayout( groupLayout );

  mUseWholeBook = new QRadioButton( i18n( "&All contacts" ), mButtonGroup );
  mUseWholeBook->setChecked( true );
  mUseWholeBook->setWhatsThis( i18n( "Export the entire address book" ) );
  groupLayout->addWidget( mUseWholeBook, 0, 0 );
  mUseSelection = new QRadioButton( i18np( "&Selected contact", "&Selected contacts (%1 selected)", mCore->selectedUIDs().count() ), mButtonGroup );
  mUseSelection->setWhatsThis( i18n( "Only export contacts selected in KAddressBook.\n"
                                        "This option is disabled if no contacts are selected." ) );
  groupLayout->addWidget( mUseSelection, 1, 0 );

  mUseFilters = new QRadioButton( i18n( "Contacts matching &filter" ), mButtonGroup );
  mUseFilters->setWhatsThis( i18n( "Only export contacts matching the selected filter.\n"
                                     "This option is disabled if you have not defined any filters" ) );
  groupLayout->addWidget( mUseFilters, 2, 0 );

  mUseCategories = new QRadioButton( i18n( "Category &members" ), mButtonGroup );
  mUseCategories->setWhatsThis( i18n( "Only export contacts who are members of a category that is checked on the list to the left.\n"
                                       "This option is disabled if you have no categories." ) );
  groupLayout->addWidget( mUseCategories, 3, 0, Qt::AlignTop );

  mFiltersCombo = new KComboBox( mButtonGroup );
  mFiltersCombo->setEditable( false );
  mFiltersCombo->setWhatsThis( i18n( "Select a filter to decide which contacts to export." ) );
  groupLayout->addWidget( mFiltersCombo, 2, 1 );

  mCategoriesView = new KPIM::CategorySelectWidget( mButtonGroup, KABPrefs::instance() );
  mCategoriesView->hideButton();
  mCategoriesView->layout()->setMargin( 0 );
  mCategoriesView->setWhatsThis( i18n( "Check the categories whose members you want to print." ) );
  groupLayout->addWidget( mCategoriesView, 3, 1 );
  connect( mCategoriesView->listView(),
           SIGNAL( itemClicked( QTreeWidgetItem *, int ) ),
           this, SLOT( categoryClicked() ) );

  topLayout->addWidget( mButtonGroup );

  QGroupBox *sortingGroup = new QGroupBox( i18n( "Sorting" ), page );
  QGridLayout *sortLayout = new QGridLayout();
  sortLayout->setSpacing( KDialog::spacingHint() );
  sortLayout->setAlignment( Qt::AlignTop );
  sortingGroup->setLayout( sortLayout );

  label = new QLabel( i18n( "Criterion:" ), sortingGroup );
  sortLayout->addWidget( label, 0, 0 );

  mFieldCombo = new KComboBox( false, sortingGroup );
  sortLayout->addWidget( mFieldCombo, 0, 1 );

  label = new QLabel( i18n( "Order:" ), sortingGroup );
  sortLayout->addWidget( label, 1, 0 );

  mSortTypeCombo = new KComboBox( false, sortingGroup );
  sortLayout->addWidget( mSortTypeCombo, 1, 1 );

  topLayout->addWidget( sortingGroup );

  if ( !mUseSorting )
    sortingGroup->hide();
}
コード例 #30
0
ファイル: pathstroke.cpp プロジェクト: Kwangsub/qt-openwebos
void PathStrokeControls::layoutForSmallScreens()
{
    createCommonControls(this);

    m_capGroup->layout()->setMargin(0);
    m_joinGroup->layout()->setMargin(0);
    m_styleGroup->layout()->setMargin(0);
    m_pathModeGroup->layout()->setMargin(0);

    QPushButton* okBtn = new QPushButton(tr("OK"), this);
    okBtn->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    okBtn->setMinimumSize(100,okBtn->minimumSize().height());

    QPushButton* quitBtn = new QPushButton(tr("Quit"), this);
    quitBtn->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    quitBtn->setMinimumSize(100, okBtn->minimumSize().height());

    QLabel *penWidthLabel = new QLabel(tr(" Width:"));
    QSlider *penWidth = new QSlider(Qt::Horizontal, this);
    penWidth->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
    penWidth->setRange(0, 500);

#ifdef QT_OPENGL_SUPPORT
    QPushButton *enableOpenGLButton = new QPushButton(this);
    enableOpenGLButton->setText(tr("Use OpenGL"));
    enableOpenGLButton->setCheckable(true);
    enableOpenGLButton->setChecked(m_renderer->usesOpenGL());
    if (!QGLFormat::hasOpenGL())
        enableOpenGLButton->hide();
#endif

    // Layouts:
    QHBoxLayout *penWidthLayout = new QHBoxLayout(0);
    penWidthLayout->addWidget(penWidthLabel, 0, Qt::AlignRight);
    penWidthLayout->addWidget(penWidth);

    QVBoxLayout *leftLayout = new QVBoxLayout(0);
    leftLayout->addWidget(m_capGroup);
    leftLayout->addWidget(m_joinGroup);
#ifdef QT_OPENGL_SUPPORT
    leftLayout->addWidget(enableOpenGLButton);
#endif
    leftLayout->addLayout(penWidthLayout);

    QVBoxLayout *rightLayout = new QVBoxLayout(0);
    rightLayout->addWidget(m_styleGroup);
    rightLayout->addWidget(m_pathModeGroup);

    QGridLayout *mainLayout = new QGridLayout(this);
    mainLayout->setMargin(0);

    // Add spacers around the form items so we don't look stupid at higher resolutions
    mainLayout->addItem(new QSpacerItem(0,0), 0, 0, 1, 4);
    mainLayout->addItem(new QSpacerItem(0,0), 1, 0, 2, 1);
    mainLayout->addItem(new QSpacerItem(0,0), 1, 3, 2, 1);
    mainLayout->addItem(new QSpacerItem(0,0), 3, 0, 1, 4);

    mainLayout->addLayout(leftLayout, 1, 1);
    mainLayout->addLayout(rightLayout, 1, 2);
    mainLayout->addWidget(quitBtn, 2, 1, Qt::AlignHCenter | Qt::AlignTop);
    mainLayout->addWidget(okBtn, 2, 2, Qt::AlignHCenter | Qt::AlignTop);

#ifdef QT_OPENGL_SUPPORT
    connect(enableOpenGLButton, SIGNAL(clicked(bool)), m_renderer, SLOT(enableOpenGL(bool)));
#endif

    connect(penWidth, SIGNAL(valueChanged(int)), m_renderer, SLOT(setPenWidth(int)));
    connect(quitBtn, SIGNAL(clicked()), this, SLOT(emitQuitSignal()));
    connect(okBtn, SIGNAL(clicked()), this, SLOT(emitOkSignal()));

    m_renderer->setAnimation(true);
    penWidth->setValue(50);
}