コード例 #1
0
ファイル: pmquery.cpp プロジェクト: Aconex/pcp
PmQuery::PmQuery(bool inputflag, bool printflag, bool noframeflag,
		 bool nosliderflag, bool usesliderflag, bool exclusiveflag)
    : QDialog()
{
    QHBoxLayout *hboxLayout;
    QVBoxLayout *vboxLayout;
    QSpacerItem *spacerItem;
    QSpacerItem *spacerItem1;
    QVBoxLayout *vboxLayout1;
    QHBoxLayout *hboxLayout1;
    QSpacerItem *spacerItem2;

    QString filename;
    if (iconic == HOST_ICON)
	filename = tr(":images/dialog-host.png");
    else if (iconic == ERROR_ICON)
	filename = tr(":images/dialog-error.png");
    else if (iconic == WARNING_ICON)
	filename = tr(":images/dialog-warning.png");
    else if (iconic == ARCHIVE_ICON)
	filename = tr(":images/dialog-archive.png");
    else if (iconic == QUESTION_ICON)
	filename = tr(":images/dialog-question.png");
    else // (iconic == INFO_ICON)
	filename = tr(":images/dialog-information.png");

    QIcon	icon(filename);
    QPixmap	pixmap(filename);
    setWindowIcon(icon);
    setWindowTitle(tr(title));

    QGridLayout *gridLayout = new QGridLayout(this);
    gridLayout->setSpacing(6);
    gridLayout->setMargin(9);
    hboxLayout = new QHBoxLayout();
    hboxLayout->setSpacing(6);
    hboxLayout->setMargin(0);
    vboxLayout = new QVBoxLayout();
    vboxLayout->setSpacing(6);
    vboxLayout->setMargin(0);
    spacerItem = new QSpacerItem(20, 2, QSizePolicy::Minimum,
					QSizePolicy::Expanding);

    vboxLayout->addItem(spacerItem);

    QLabel *imageLabel = new QLabel(this);
    imageLabel->setPixmap(pixmap);

    vboxLayout->addWidget(imageLabel);

    spacerItem1 = new QSpacerItem(20, 20, QSizePolicy::Minimum,
					  QSizePolicy::Expanding);

    vboxLayout->addItem(spacerItem1);
    hboxLayout->addLayout(vboxLayout);
    vboxLayout1 = new QVBoxLayout();
    vboxLayout1->setSpacing(6);
    vboxLayout1->setMargin(0);

    int height;
    int width = DEFAULT_EDIT_WIDTH; 

    QLineEdit* lineEdit = NULL;
    QTextEdit* textEdit = NULL;
    if (inputflag && messagecount <= 1) {
	lineEdit = new QLineEdit(this);
	if (messagecount == 1)
	    lineEdit->setText(tr(messages[0]));
	height = lineEdit->font().pointSize() + 4;
	if (height < 0)
	    height = lineEdit->font().pixelSize() + 4;
	if (height < 0)
	    height = lineEdit->heightForWidth(width) + 4;
	lineEdit->setSizePolicy(QSizePolicy::MinimumExpanding,
				QSizePolicy::Fixed);
	lineEdit->setMinimumSize(QSize(width, height));
	lineEdit->setGeometry(QRect(0, 0, width, height));
	vboxLayout1->addWidget(lineEdit);
    }
    else {
	QFont	fixed("monospace");
	fixed.setStyleHint(QFont::TypeWriter);

	textEdit = new QTextEdit(this);
	textEdit->setFont(fixed);
	textEdit->setLineWrapMode(QTextEdit::FixedColumnWidth);
	textEdit->setLineWrapColumnOrWidth(80);
	textEdit->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	if (nosliderflag)
	    textEdit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	else if (usesliderflag)
	    textEdit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
	else
	    textEdit->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
	for (int m = 0; m < messagecount; m++)
	    textEdit->append(tr(messages[m]));
	if (inputflag)
	    textEdit->setReadOnly(FALSE);
	else {
	    textEdit->setLineWidth(1);
	    textEdit->setFrameStyle(noframeflag ? QFrame::NoFrame :
				    QFrame::Box | QFrame::Sunken);
	    textEdit->setReadOnly(TRUE);
	}
	if (usesliderflag)
	    height = DEFAULT_EDIT_HEIGHT;
	else {
	    height = textEdit->font().pointSize() + 4;
	    if (height < 0)
		height = textEdit->font().pixelSize() + 4;
	    if (height < 0)
	        height = textEdit->heightForWidth(width) + 4;
	    height *= messagecount;
	}
	textEdit->setMinimumSize(QSize(width, height));
	textEdit->setSizePolicy(QSizePolicy::MinimumExpanding,
				QSizePolicy::MinimumExpanding);
	textEdit->moveCursor(QTextCursor::Start);
	textEdit->ensureCursorVisible();
	vboxLayout1->addWidget(textEdit);
    }

    hboxLayout1 = new QHBoxLayout();
    hboxLayout1->setSpacing(6);
    hboxLayout1->setMargin(0);
    spacerItem2 = new QSpacerItem(40, 20, QSizePolicy::Expanding,
					  QSizePolicy::Minimum);
    hboxLayout1->addItem(spacerItem2);

    for (int i = 0; i < buttoncount; i++) {
	QueryButton *button = new QueryButton(printflag, this);
	button->setMinimumSize(QSize(72, 32));
	button->setDefault(buttons[i] == defaultbutton);
	button->setQuery(this);
	button->setText(tr(buttons[i]));
	button->setStatus(statusi[i]);
	if (inputflag && buttons[i] == defaultbutton) {
	    if (textEdit) 
		button->setEditor(textEdit);
	    else if (lineEdit) {
		button->setEditor(lineEdit);
		if (buttons[i] == defaultbutton)
		    connect(lineEdit, SIGNAL(returnPressed()),
			    button, SLOT(click()));
	    }
	}
	connect(button, SIGNAL(clicked()), this, SLOT(buttonClicked()));
	hboxLayout1->addWidget(button);
    }

    vboxLayout1->addLayout(hboxLayout1);
    hboxLayout->addLayout(vboxLayout1);
    gridLayout->addLayout(hboxLayout, 0, 0, 1, 1);
    gridLayout->setSizeConstraint(QLayout::SetFixedSize);

    if (inputflag && messagecount <= 1)
	resize(QSize(320, 83));
    else
	resize(QSize(320, 132));

    if (timeout)
	startTimer(timeout * 1000);

    if (exclusiveflag)
	setWindowModality(Qt::WindowModal);
}
コード例 #2
0
HtmlInfoView::HtmlInfoView(QWidget * parent) : QScrollArea(parent) 
{
    this->setWidgetResizable(true);
	this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    QFrame * mainFrame = new QFrame(this);
	mainFrame->setObjectName("infoViewMainFrame");

	m_lastTitleItemBase = NULL;
	m_lastTagsModelPart = NULL;
	m_lastConnectorItem = NULL;
	m_lastIconModelPart = NULL;
	m_lastPropsModelPart = NULL;
	m_lastPropsItemBase = NULL;

	m_partTitle = NULL;
	m_partUrl = NULL;
	m_partVersion = NULL;
	m_lockCheckbox = NULL;
	m_connDescr = NULL;
	m_tagsTextLabel = NULL;
	m_lastSwappingEnabled = false;
	m_lastItemBase = NULL;
	m_infoGraphicsView = NULL;
	m_setContentTimer.setSingleShot(true);
	m_setContentTimer.setInterval(10);
	connect(&m_setContentTimer, SIGNAL(timeout()), this, SLOT(setContent()));
	QVBoxLayout *vlo = new QVBoxLayout(mainFrame);
	vlo->setSpacing(0);
	vlo->setContentsMargins(0, 0, 0, 0);
	vlo->setSizeConstraint( QLayout::SetMinAndMaxSize );

        /* Part Title */

	m_titleEdit = new FLineEdit(mainFrame);
	m_titleEdit->setObjectName("instanceTitleEditor");
	m_titleEdit->setToolTip(tr("Change the part label here"));
	m_titleEdit->setAlignment(Qt::AlignLeft);

	connect(m_titleEdit, SIGNAL(editingFinished()), this, SLOT(setInstanceTitle()));
	connect(m_titleEdit, SIGNAL(mouseEnter()), this, SLOT(instanceTitleEnter()));
	connect(m_titleEdit, SIGNAL(mouseLeave()), this, SLOT(instanceTitleLeave()));
	connect(m_titleEdit, SIGNAL(editable(bool)), this, SLOT(instanceTitleEditable(bool)));

	setInstanceTitleColors(m_titleEdit, QColor(0xaf, 0xaf, 0xb4), QColor(0x00, 0x00, 0x00)); //b3b3b3, 575757
	m_titleEdit->setAutoFillBackground(true);
	vlo->addWidget(m_titleEdit);

        /* Part Icons */

	if (NoIcon == NULL) {
		NoIcon = new QPixmap(":/resources/images/icons/noicon.png");
	}

	QFrame * iconFrame = new QFrame(mainFrame);
	iconFrame->setObjectName("iconFrame");

	QHBoxLayout * hboxLayout = new QHBoxLayout();
	hboxLayout->setContentsMargins(0, 0, 0, 0);
	hboxLayout->addSpacing(IconSpace);
	m_icon1 = addLabel(hboxLayout, NoIcon);
	m_icon1->setToolTip(tr("Part breadboard view image"));
	m_icon2 = addLabel(hboxLayout, NoIcon);
	m_icon2->setToolTip(tr("Part schematic view image"));
	m_icon3 = addLabel(hboxLayout, NoIcon);
	m_icon3->setToolTip(tr("Part pcb view image"));

	QVBoxLayout * versionLayout = new QVBoxLayout();

	QHBoxLayout * subVersionLayout = new QHBoxLayout();
	m_partVersion = new QLabel();
	m_partVersion->setObjectName("infoViewPartVersion");
	m_partVersion->setToolTip(tr("Part version number"));
	subVersionLayout->addWidget(m_partVersion, 0, Qt::AlignLeft);
	subVersionLayout->addStretch(1);
	versionLayout->addLayout(subVersionLayout);
	
	m_lockCheckbox = new QCheckBox(tr("Locked"));
	m_lockCheckbox->setObjectName("infoViewLockCheckbox");
	m_lockCheckbox->setToolTip(tr("Change the locked state of the part in this view.  A locked part can't be moved"));
	connect(m_lockCheckbox, SIGNAL(clicked(bool)), this, SLOT(changeLock(bool)));
	versionLayout->addWidget(m_lockCheckbox);

	hboxLayout->addLayout(versionLayout);
	
	hboxLayout->addSpacerItem(new QSpacerItem(IconSpace, 1, QSizePolicy::Expanding));
	iconFrame->setLayout(hboxLayout);
	vlo->addWidget(iconFrame);

	m_partUrl = new TagLabel(this);
	m_partUrl->setWordWrap(false);
	m_partUrl->setObjectName("infoViewPartUrl");
	m_partUrl->setOpenExternalLinks(true);
	vlo->addWidget(m_partUrl);

	m_partTitle = new TagLabel(this);
	m_partTitle->setWordWrap(true);
	m_partTitle->setObjectName("infoViewPartTitle");
	m_partTitle->setOpenExternalLinks(true);
	vlo->addWidget(m_partTitle);

	m_proplabel = new QLabel(tr("Properties"), NULL);
	m_proplabel->setObjectName("expandableViewLabel");
	vlo->addWidget(m_proplabel);

	m_propFrame = new QFrame(this);
	m_propFrame->setObjectName("infoViewPropertyFrame");
	m_propLayout = new QGridLayout(m_propFrame);
	m_propLayout->setSpacing(0);
	m_propLayout->setContentsMargins(0, 0, 0, 0);
	m_propFrame->setLayout(m_propLayout);
	vlo->addWidget(m_propFrame);

	m_taglabel = new QLabel(tr("Tags"), NULL);
	m_taglabel->setObjectName("expandableViewLabel");
	vlo->addWidget(m_taglabel);

	m_tagsTextLabel = new TagLabel(this);
	m_tagsTextLabel->setWordWrap(true);
	m_tagsTextLabel->setObjectName("tagsValue");
	vlo->addWidget(m_tagsTextLabel);

	m_connLabel = new QLabel(tr("Connections"), NULL);
	m_connLabel->setObjectName("expandableViewLabel");
	vlo->addWidget(m_connLabel);

	m_connFrame = new QFrame(this);
	m_connFrame->setObjectName("connectionsFrame");

    QGridLayout * connLayout = new QGridLayout(m_connFrame);
	connLayout->setSpacing(0);
	connLayout->setContentsMargins(0, 0, 0, 0);
	m_connFrame->setLayout(connLayout);

	QLabel * descrLabel = new QLabel(tr("conn."), this);
	descrLabel->setObjectName("connectionsLabel");
	m_connDescr = new QLabel(this);
	m_connDescr->setObjectName("connectionsValue");
    connLayout->addWidget(descrLabel, 0, 0);
    connLayout->addWidget(m_connDescr, 0, 1);

	QLabel * nameLabel = new QLabel(tr("name"), this);
	nameLabel->setObjectName("connectionsLabel");
	m_connName = new QLabel(this);
	m_connName->setObjectName("connectionsValue");
    connLayout->addWidget(nameLabel, 1, 0);
    connLayout->addWidget(m_connName, 1, 1);

	QLabel * typeLabel = new QLabel(tr("type"), this);
	typeLabel->setObjectName("connectionsLabel");
	m_connType = new QLabel(this);
	m_connType->setObjectName("connectionsValue");
	connLayout->addWidget(typeLabel, 2, 0);
    connLayout->addWidget(m_connType, 2, 1);

	vlo->addWidget(m_connFrame);

	vlo->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding));

	mainFrame->setLayout(vlo);

	this->setWidget(mainFrame);

	m_currentItem = NULL;
	m_currentSwappingEnabled = false;

}
コード例 #3
0
ファイル: qfontdialog.cpp プロジェクト: 13W/phantomjs
void QFontDialogPrivate::init()
{
    Q_Q(QFontDialog);

#ifdef Q_WS_MAC
    nativeDialogInUse = false;
    delegate = 0;
#endif

    q->setSizeGripEnabled(true);
    q->setWindowTitle(QFontDialog::tr("Select Font"));

    // grid
    familyEdit = new QLineEdit(q);
    familyEdit->setReadOnly(true);
    familyList = new QFontListView(q);
    familyEdit->setFocusProxy(familyList);

    familyAccel = new QLabel(q);
#ifndef QT_NO_SHORTCUT
    familyAccel->setBuddy(familyList);
#endif
    familyAccel->setIndent(2);

    styleEdit = new QLineEdit(q);
    styleEdit->setReadOnly(true);
    styleList = new QFontListView(q);
    styleEdit->setFocusProxy(styleList);

    styleAccel = new QLabel(q);
#ifndef QT_NO_SHORTCUT
    styleAccel->setBuddy(styleList);
#endif
    styleAccel->setIndent(2);

    sizeEdit = new QLineEdit(q);
    sizeEdit->setFocusPolicy(Qt::ClickFocus);
    QIntValidator *validator = new QIntValidator(1, 512, q);
    sizeEdit->setValidator(validator);
    sizeList = new QFontListView(q);

    sizeAccel = new QLabel(q);
#ifndef QT_NO_SHORTCUT
    sizeAccel->setBuddy(sizeEdit);
#endif
    sizeAccel->setIndent(2);

    // effects box
    effects = new QGroupBox(q);
    QVBoxLayout *vbox = new QVBoxLayout(effects);
    strikeout = new QCheckBox(effects);
    vbox->addWidget(strikeout);
    underline = new QCheckBox(effects);
    vbox->addWidget(underline);

    sample = new QGroupBox(q);
    QHBoxLayout *hbox = new QHBoxLayout(sample);
    sampleEdit = new QLineEdit(sample);
    sampleEdit->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored));
    sampleEdit->setAlignment(Qt::AlignCenter);
    // Note that the sample text is *not* translated with tr(), as the
    // characters used depend on the charset encoding.
    sampleEdit->setText(QLatin1String("AaBbYyZz"));
    hbox->addWidget(sampleEdit);

    writingSystemCombo = new QComboBox(q);

    writingSystemAccel = new QLabel(q);
#ifndef QT_NO_SHORTCUT
    writingSystemAccel->setBuddy(writingSystemCombo);
#endif
    writingSystemAccel->setIndent(2);

    size = 0;
    smoothScalable = false;

    QObject::connect(writingSystemCombo, SIGNAL(activated(int)), q, SLOT(_q_writingSystemHighlighted(int)));
    QObject::connect(familyList, SIGNAL(highlighted(int)), q, SLOT(_q_familyHighlighted(int)));
    QObject::connect(styleList, SIGNAL(highlighted(int)), q, SLOT(_q_styleHighlighted(int)));
    QObject::connect(sizeList, SIGNAL(highlighted(int)), q, SLOT(_q_sizeHighlighted(int)));
    QObject::connect(sizeEdit, SIGNAL(textChanged(QString)), q, SLOT(_q_sizeChanged(QString)));

    QObject::connect(strikeout, SIGNAL(clicked()), q, SLOT(_q_updateSample()));
    QObject::connect(underline, SIGNAL(clicked()), q, SLOT(_q_updateSample()));

    for (int i = 0; i < QFontDatabase::WritingSystemsCount; ++i) {
        QFontDatabase::WritingSystem ws = QFontDatabase::WritingSystem(i);
        QString writingSystemName = QFontDatabase::writingSystemName(ws);
        if (writingSystemName.isEmpty())
            break;
        writingSystemCombo->addItem(writingSystemName);
    }

    updateFamilies();
    if (familyList->count() != 0)
        familyList->setCurrentItem(0);

    // grid layout
    QGridLayout *mainGrid = new QGridLayout(q);

    int spacing = mainGrid->spacing();
    if (spacing >= 0) {     // uniform spacing
       mainGrid->setSpacing(0);

       mainGrid->setColumnMinimumWidth(1, spacing);
       mainGrid->setColumnMinimumWidth(3, spacing);

       int margin = 0;
       mainGrid->getContentsMargins(0, 0, 0, &margin);

       mainGrid->setRowMinimumHeight(3, margin);
       mainGrid->setRowMinimumHeight(6, 2);
       mainGrid->setRowMinimumHeight(8, margin);
    }

    mainGrid->addWidget(familyAccel, 0, 0);
    mainGrid->addWidget(familyEdit, 1, 0);
    mainGrid->addWidget(familyList, 2, 0);

    mainGrid->addWidget(styleAccel, 0, 2);
    mainGrid->addWidget(styleEdit, 1, 2);
    mainGrid->addWidget(styleList, 2, 2);

    mainGrid->addWidget(sizeAccel, 0, 4);
    mainGrid->addWidget(sizeEdit, 1, 4);
    mainGrid->addWidget(sizeList, 2, 4);

    mainGrid->setColumnStretch(0, 38);
    mainGrid->setColumnStretch(2, 24);
    mainGrid->setColumnStretch(4, 10);

    mainGrid->addWidget(effects, 4, 0);

    mainGrid->addWidget(sample, 4, 2, 4, 3);

    mainGrid->addWidget(writingSystemAccel, 5, 0);
    mainGrid->addWidget(writingSystemCombo, 7, 0);

    buttonBox = new QDialogButtonBox(q);
    mainGrid->addWidget(buttonBox, 9, 0, 1, 5);

    QPushButton *button
            = static_cast<QPushButton *>(buttonBox->addButton(QDialogButtonBox::Ok));
    QObject::connect(buttonBox, SIGNAL(accepted()), q, SLOT(accept()));
    button->setDefault(true);

    buttonBox->addButton(QDialogButtonBox::Cancel);
    QObject::connect(buttonBox, SIGNAL(rejected()), q, SLOT(reject()));

#if defined(Q_WS_WINCE)
    q->resize(180, 120);
#elif defined(Q_WS_S60)
    q->resize(QApplication::desktop()->availableGeometry(QCursor::pos()).size());
#else
    q->resize(500, 360);
#endif // Q_WS_WINCE

    sizeEdit->installEventFilter(q);
    familyList->installEventFilter(q);
    styleList->installEventFilter(q);
    sizeList->installEventFilter(q);

    familyList->setFocus();
    retranslateStrings();
}
コード例 #4
0
ファイル: pianoroll.cpp プロジェクト: 33akash/MuseScore
PianorollEditor::PianorollEditor(QWidget* parent)
   : QMainWindow(parent)
      {
      setWindowTitle(QString("MuseScore"));

      waveView = 0;
      _score = 0;
      staff  = 0;

      QWidget* mainWidget = new QWidget;

      QToolBar* tb = addToolBar(tr("toolbar 1"));
      tb->addAction(getAction("undo"));
      tb->addAction(getAction("redo"));
      tb->addSeparator();
#ifdef HAS_MIDI
      tb->addAction(getAction("midi-on"));
#endif
      tb->addSeparator();

      tb->addAction(getAction("rewind"));
      tb->addAction(getAction("play"));
      tb->addSeparator();

      tb->addAction(getAction("loop"));
      tb->addSeparator();
      tb->addAction(getAction("repeat"));
      tb->addAction(getAction("follow"));
      tb->addSeparator();
      tb->addAction(getAction("metronome"));

      showWave = new QAction(tr("Wave"), tb);
      showWave->setToolTip(tr("show wave display"));
      showWave->setCheckable(true);
      showWave->setChecked(false);
      connect(showWave, SIGNAL(toggled(bool)), SLOT(showWaveView(bool)));
      tb->addAction(showWave);

      //-------------
      tb = addToolBar(tr("toolbar 2"));
      static const char* sl3[] = { "voice-1", "voice-2", "voice-3", "voice-4" };
      QActionGroup* voiceGroup = new QActionGroup(this);
      for (const char* s : sl3) {
            QAction* a = getAction(s);
            a->setCheckable(true);
            voiceGroup->addAction(a);
            tb->addAction(getAction(s));
            }

      tb->addSeparator();
      tb->addWidget(new QLabel(tr("Cursor:")));
      pos = new Awl::PosLabel;
      pos->setFrameStyle(QFrame::NoFrame | QFrame::Plain);

      tb->addWidget(pos);
      Awl::PitchLabel* pl = new Awl::PitchLabel();
      pl->setFrameStyle(QFrame::NoFrame | QFrame::Plain);
      tb->addWidget(pl);

      tb->addSeparator();
      tb->addWidget(new QLabel(tr("Velocity:")));
      veloType = new QComboBox;
      veloType->addItem(tr("offset"), MScore::OFFSET_VAL);
      veloType->addItem(tr("user"),   MScore::USER_VAL);
      tb->addWidget(veloType);

      velocity = new QSpinBox;
      velocity->setRange(-1, 127);
      velocity->setSpecialValueText("--");
      velocity->setReadOnly(true);
      tb->addWidget(velocity);

      tb->addWidget(new QLabel(tr("Pitch:")));
      pitch = new Awl::PitchEdit;
      pitch->setReadOnly(true);
      tb->addWidget(pitch);

      //-------------
      qreal xmag = .1;
      ruler = new Ruler;
      ruler->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
      ruler->setFixedHeight(rulerHeight);

      ruler->setMag(xmag, 1.0);

      Piano* piano = new Piano;
      piano->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
      piano->setFixedWidth(pianoWidth);

      gv  = new PianoView;
      gv->scale(xmag, 1.0);
      gv->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
      gv->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

      hsb = new QScrollBar(Qt::Horizontal);
      connect(gv->horizontalScrollBar(), SIGNAL(rangeChanged(int,int)),
         SLOT(rangeChanged(int,int)));

      // layout
      QHBoxLayout* hbox = new QHBoxLayout;
      hbox->setSpacing(0);
      hbox->addWidget(piano);
      hbox->addWidget(gv);

      split = new QSplitter(Qt::Vertical);
      split->setFrameShape(QFrame::NoFrame);

      QWidget* split1 = new QWidget;      // piano - pianoview
      split1->setLayout(hbox);
      split->addWidget(split1);

      QGridLayout* layout = new QGridLayout;
      layout->setContentsMargins(0, 0, 0, 0);
      layout->setSpacing(0);
      layout->setColumnMinimumWidth(0, pianoWidth + 5);
      layout->addWidget(tb,    0, 0, 1, 2);
      layout->addWidget(ruler, 1, 1);
      layout->addWidget(split, 2, 0, 1, 2);
      layout->addWidget(hsb,   3, 1);

      mainWidget->setLayout(layout);
      setCentralWidget(mainWidget);

      connect(gv->verticalScrollBar(), SIGNAL(valueChanged(int)), piano, SLOT(setYpos(int)));

      connect(gv,          SIGNAL(magChanged(double,double)),  ruler, SLOT(setMag(double,double)));
      connect(gv,          SIGNAL(magChanged(double,double)),  piano, SLOT(setMag(double,double)));
      connect(gv,          SIGNAL(pitchChanged(int)),          pl,    SLOT(setPitch(int)));
      connect(gv,          SIGNAL(pitchChanged(int)),          piano, SLOT(setPitch(int)));
      connect(piano,       SIGNAL(pitchChanged(int)),          pl,    SLOT(setPitch(int)));
      connect(gv,          SIGNAL(posChanged(const Pos&)),     pos,   SLOT(setValue(const Pos&)));
      connect(gv,          SIGNAL(posChanged(const Pos&)),     ruler, SLOT(setPos(const Pos&)));
      connect(ruler,       SIGNAL(posChanged(const Pos&)),     pos,   SLOT(setValue(const Pos&)));

      connect(hsb,         SIGNAL(valueChanged(int)),  SLOT(setXpos(int)));
      connect(gv,          SIGNAL(xposChanged(int)),   SLOT(setXpos(int)));
      connect(gv->horizontalScrollBar(), SIGNAL(valueChanged(int)), SLOT(setXpos(int)));

      connect(ruler,       SIGNAL(locatorMoved(int, const Pos&)), SLOT(moveLocator(int, const Pos&)));
      connect(veloType,    SIGNAL(activated(int)),     SLOT(veloTypeChanged(int)));
      connect(velocity,    SIGNAL(valueChanged(int)),  SLOT(velocityChanged(int)));
      connect(gv->scene(), SIGNAL(selectionChanged()), SLOT(selectionChanged()));
      connect(piano,       SIGNAL(keyPressed(int)),    SLOT(keyPressed(int)));
      connect(piano,       SIGNAL(keyReleased(int)),   SLOT(keyReleased(int)));
      resize(800, 400);

      QActionGroup* ag = new QActionGroup(this);
      QAction* a = new QAction(this);
      a->setData("delete");
      a->setShortcut(Qt::Key_Delete);
      ag->addAction(a);
      addActions(ag->actions());
      connect(ag, SIGNAL(triggered(QAction*)), SLOT(cmd(QAction*)));
      setXpos(0);
      }
コード例 #5
0
void WindowMaterialGasInspectorView::createLayout()
{
  QWidget* hiddenWidget = new QWidget();
  this->stackedWidget()->addWidget(hiddenWidget);

  QWidget* visibleWidget = new QWidget();
  this->stackedWidget()->addWidget(visibleWidget);

  QGridLayout* mainGridLayout = new QGridLayout();
  mainGridLayout->setContentsMargins(7, 7, 7, 7);
  mainGridLayout->setSpacing(14);
  visibleWidget->setLayout(mainGridLayout);

  int row = mainGridLayout->rowCount();

  QLabel * label = nullptr;

  // Name

  label = new QLabel("Name: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label, row, 0);

  ++row;

  m_nameEdit = new OSLineEdit();
  mainGridLayout->addWidget(m_nameEdit, row, 0, 1, 3);

  ++row;

  // Standards Information

  m_standardsInformationWidget = new StandardsInformationMaterialWidget(m_isIP, mainGridLayout, row);

  ++row;

  // Gas Type

  label = new QLabel("Gas Type: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,0);

  m_gasType = new OSComboBox();
  m_gasType->addItem("Air");
  m_gasType->addItem("Argon");
  m_gasType->addItem("Krypton");
  m_gasType->addItem("Xenon");
  m_gasType->addItem("Custom");
  mainGridLayout->addWidget(m_gasType,row++,0,1,3);

  // Thickness

  label = new QLabel("Thickness: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,0);

  m_thickness = new OSQuantityEdit(m_isIP);
  connect(this, &WindowMaterialGasInspectorView::toggleUnitsClicked, m_thickness, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_thickness,row++,0,1,3);

  // Conductivity Coefficient A

  label = new QLabel("Conductivity Coefficient A: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,0);

  m_conductivityCoefficientA = new OSQuantityEdit(m_isIP);
  connect(this, &WindowMaterialGasInspectorView::toggleUnitsClicked, m_conductivityCoefficientA, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_conductivityCoefficientA,row++,0,1,3);

  // Conductivity Coefficient B

  label = new QLabel("Conductivity Coefficient B: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,0);

  m_conductivityCoefficientB = new OSQuantityEdit(m_isIP);
  connect(this, &WindowMaterialGasInspectorView::toggleUnitsClicked, m_conductivityCoefficientB, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_conductivityCoefficientB,row++,0,1,3);

  // Viscosity Coefficient A

  label = new QLabel("Viscosity Coefficient A: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,0);

  m_viscosityCoefficientA = new OSQuantityEdit(m_isIP);
  connect(this, &WindowMaterialGasInspectorView::toggleUnitsClicked, m_viscosityCoefficientA, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_viscosityCoefficientA,row++,0,1,3);

  // Viscosity Coefficient B

  label = new QLabel("Viscosity Coefficient B: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,0);

  m_viscosityCoefficientB = new OSQuantityEdit(m_isIP);
  connect(this, &WindowMaterialGasInspectorView::toggleUnitsClicked, m_viscosityCoefficientB, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_viscosityCoefficientB,row++,0,1,3);

  // Specific Heat Coefficient A

  label = new QLabel("Specific Heat Coefficient A: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,0);

  m_specificHeatCoefficientA = new OSQuantityEdit(m_isIP);
  connect(this, &WindowMaterialGasInspectorView::toggleUnitsClicked, m_specificHeatCoefficientA, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_specificHeatCoefficientA,row++,0,1,3);

  // Specific Heat Coefficient B

  label = new QLabel("Specific Heat Coefficient B: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,0);

  m_specificHeatCoefficientB = new OSQuantityEdit(m_isIP);
  connect(this, &WindowMaterialGasInspectorView::toggleUnitsClicked, m_specificHeatCoefficientB, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_specificHeatCoefficientB,row++,0,1,3);

  // Molecular Weight

  label = new QLabel("Molecular Weight: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,0);

  m_molecularWeight = new OSQuantityEdit(m_isIP);
  connect(this, &WindowMaterialGasInspectorView::toggleUnitsClicked, m_molecularWeight, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_molecularWeight,row++,0,1,3);

  // Stretch

  mainGridLayout->setRowStretch(100,100);

  mainGridLayout->setColumnStretch(100,100);
}
コード例 #6
0
void  TagImgDlg::initDialog(){
  QGridLayout *grid = new QGridLayout( this );
  grid->setSpacing( 13 );
  grid->setMargin( 11 );
  labelImgSource= new QLabel(this,"labelImgSource");
  labelImgSource->setText(i18n("Image source:"));
  grid->addMultiCellWidget(labelImgSource, 0, 0, 0, 0);

  lineImgSource= new KLineEdit(this,"lineImgSource");
  grid->addMultiCellWidget(lineImgSource, 0, 0, 1, 3);

  buttonImgSource= new QPushButton(this,"NoName");
  buttonImgSource->setText(i18n("..."));
  grid->addMultiCellWidget(buttonImgSource, 0, 0, 4, 4);

  QTag *imgTag = m_dtd->tagsList->find("img");

  if (!imgTag)
    return;

  lineWidth = 0L;
  if (imgTag->attribute("width"))
  {
    QLabel_4= new QLabel(this,"NoName");
    QLabel_4->setText(i18n("Width:"));
    grid->addMultiCellWidget(QLabel_4, 1, 1, 0, 0);
  
    lineWidth= new KLineEdit(this,"NoName");
    lineWidth->setValidator( new KFloatValidator( lineWidth ) );
    grid->addMultiCellWidget(lineWidth, 1, 1, 1, 1);
  }

  lineHeight = 0L;
  if (imgTag->attribute("height"))
  {
    QLabel_5= new QLabel(this,"NoName");
    QLabel_5->setText(i18n("Height:"));
    grid->addMultiCellWidget(QLabel_5, 1, 1, 2, 2);
  
    lineHeight= new KLineEdit(this,"NoName");
    lineHeight->setValidator( new KFloatValidator( lineHeight ) );
    grid->addMultiCellWidget(lineHeight, 1, 1, 3, 3);
  }

  buttonRecalcImgSize= new QPushButton(this,"NoName");
  buttonRecalcImgSize->setText(i18n("..."));
  grid->addMultiCellWidget(buttonRecalcImgSize, 1, 1, 4, 4);

  lineHSpace = 0L;
  if (imgTag->attribute("hspace"))
  {
    QLabel_6= new QLabel(this,"NoName");
    QLabel_6->setText(i18n("HSpace:"));
    grid->addMultiCellWidget(QLabel_6, 2, 2, 0, 0);
  
    lineHSpace= new KLineEdit(this,"NoName");
    grid->addMultiCellWidget(lineHSpace, 2, 2, 1, 1);
  }

  lineVSpace = 0L;
  if (imgTag->attribute("vspace"))
  {
    QLabel_7= new QLabel(this,"NoName");
    QLabel_7->setText(i18n("VSpace:"));
    grid->addMultiCellWidget(QLabel_7, 2, 2, 2, 2);
  
    lineVSpace= new KLineEdit(this,"NoName");
    grid->addMultiCellWidget(lineVSpace, 2, 2, 3, 3);
  }

  QLabel_8= new QLabel(this,"NoName");
  QLabel_8->setText(i18n("Alternate text:"));
  grid->addMultiCellWidget(QLabel_8, 3, 3, 0, 0);

  lineAltText= new KLineEdit(this,"NoName");
  grid->addMultiCellWidget(lineAltText, 3, 3, 1, 4);

  spinBorder = 0L;
  if (imgTag->attribute("border"))
  {
    QLabel_9= new QLabel(this,"NoName");
    QLabel_9->setText(i18n("Border:"));
    grid->addMultiCellWidget(QLabel_9, 4, 4, 0, 0);
  
    spinBorder= new QSpinBox(this,"NoName");
    spinBorder->setRange(0,20);
    grid->addMultiCellWidget(spinBorder, 4, 4, 1, 1);
  }

  comboAlign = 0L;
  if (imgTag->attribute("align"))
  {
    QLabel_10= new QLabel(this,"NoName");
    QLabel_10->setText(i18n("Align:"));
    grid->addMultiCellWidget(QLabel_10, 4, 4, 2, 2);
  
    comboAlign= new QComboBox(this,"NoName");
    grid->addMultiCellWidget(comboAlign, 4, 4, 3, 4);
    comboAlign->insertStringList(imgTag->attribute("align")->values);
  }

  widgetImg= new PictureView(this);
  grid->addMultiCellWidget(widgetImg, 5, 10, 0, 4);

  buttonImgSource->setPixmap( SmallIcon("fileopen") );
  buttonRecalcImgSize->setPixmap( SmallIcon("reload") );
  
}
コード例 #7
0
void ApplicationWindow::addTabs()
{
	v4l2_queryctrl qctrl;
	unsigned ctrl_class;
	unsigned i;
	int id;

	memset(&qctrl, 0, sizeof(qctrl));
	qctrl.id = V4L2_CTRL_FLAG_NEXT_CTRL;
	while (queryctrl(qctrl)) {
		if (is_valid_type(qctrl.type) &&
		    (qctrl.flags & V4L2_CTRL_FLAG_DISABLED) == 0) {
			m_ctrlMap[qctrl.id] = qctrl;
			if (qctrl.type != V4L2_CTRL_TYPE_CTRL_CLASS)
				m_classMap[V4L2_CTRL_ID2CLASS(qctrl.id)].push_back(qctrl.id);
		}
		qctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;
	}
	if (qctrl.id == V4L2_CTRL_FLAG_NEXT_CTRL) {
		strcpy((char *)qctrl.name, "User Controls");
		qctrl.id = V4L2_CTRL_CLASS_USER | 1;
		qctrl.type = V4L2_CTRL_TYPE_CTRL_CLASS;
		m_ctrlMap[qctrl.id] = qctrl;
		for (id = V4L2_CID_USER_BASE; id < V4L2_CID_LASTP1; id++) {
			qctrl.id = id;
			if (!queryctrl(qctrl))
				continue;
			if (!is_valid_type(qctrl.type))
				continue;
			if (qctrl.flags & V4L2_CTRL_FLAG_DISABLED)
				continue;
			m_ctrlMap[qctrl.id] = qctrl;
			m_classMap[V4L2_CTRL_CLASS_USER].push_back(qctrl.id);
		}
		for (qctrl.id = V4L2_CID_PRIVATE_BASE;
				queryctrl(qctrl); qctrl.id++) {
			if (!is_valid_type(qctrl.type))
				continue;
			if (qctrl.flags & V4L2_CTRL_FLAG_DISABLED)
				continue;
			m_ctrlMap[qctrl.id] = qctrl;
			m_classMap[V4L2_CTRL_CLASS_USER].push_back(qctrl.id);
		}
	}
	
	m_haveExtendedUserCtrls = false;
	for (unsigned i = 0; i < m_classMap[V4L2_CTRL_CLASS_USER].size(); i++) {
		unsigned id = m_classMap[V4L2_CTRL_CLASS_USER][i];

		if (m_ctrlMap[id].type == V4L2_CTRL_TYPE_INTEGER64 ||
		    m_ctrlMap[id].type == V4L2_CTRL_TYPE_STRING ||
		    V4L2_CTRL_DRIVER_PRIV(id)) {
			m_haveExtendedUserCtrls = true;
			break;
		}
	}

	for (ClassMap::iterator iter = m_classMap.begin(); iter != m_classMap.end(); ++iter) {
		if (iter->second.size() == 0)
			continue;
		ctrl_class = V4L2_CTRL_ID2CLASS(iter->second[0]);
		id = ctrl_class | 1;
		m_col = m_row = 0;
		m_cols = 4;

		const v4l2_queryctrl &qctrl = m_ctrlMap[id];
		QWidget *t = new QWidget(m_tabs);
		QVBoxLayout *vbox = new QVBoxLayout(t);
		QWidget *w = new QWidget(t);

		vbox->addWidget(w);

		QGridLayout *grid = new QGridLayout(w);

		grid->setSpacing(3);
		m_tabs->addTab(t, (char *)qctrl.name);
		for (i = 0; i < iter->second.size(); i++) {
			if (i & 1)
				id = iter->second[(1+iter->second.size()) / 2 + i / 2];
			else
				id = iter->second[i / 2];
			addCtrl(grid, m_ctrlMap[id]);
		}
		grid->addWidget(new QWidget(w), grid->rowCount(), 0, 1, m_cols);
		grid->setRowStretch(grid->rowCount() - 1, 1);
		w = new QWidget(t);
		vbox->addWidget(w);
		grid = new QGridLayout(w);
		finishGrid(grid, ctrl_class);
	}
}
コード例 #8
0
ファイル: kftabdlg.cpp プロジェクト: KDE/kde-baseapps
KfindTabWidget::KfindTabWidget(QWidget *parent)
  : KTabWidget( parent ), regExpDialog(0)
{
    // This validator will be used for all numeric edit fields
    //KDigitValidator *digitV = new KDigitValidator(this);

    // ************ Page One ************

    pages[0] = new QWidget;
    pages[0]->setObjectName( QLatin1String( "page1" ) );

    nameBox = new KComboBox(pages[0]);
    nameBox->setEditable( true );
    nameBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);  // allow smaller than widest entry
    QLabel * namedL = new QLabel(i18nc("this is the label for the name textfield","&Named:"), pages[0]);
    namedL->setBuddy( nameBox );
    namedL->setObjectName( QLatin1String( "named" ) );
    namedL->setToolTip( i18n("You can use wildcard matching and \";\" for separating multiple names") );
    dirBox  = new KUrlComboBox(KUrlComboBox::Directories, pages[0]);
    dirBox->setEditable( true );
    dirBox->setCompletionObject(new KUrlCompletion(KUrlCompletion::DirCompletion));
    dirBox->setAutoDeleteCompletionObject(true);
    dirBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);  // allow smaller than widest entry
    QLabel * lookinL = new QLabel(i18n("Look &in:"), pages[0]);
    lookinL->setBuddy( dirBox );
    lookinL->setObjectName( QLatin1String( "lookin" ) );
    subdirsCb  = new QCheckBox(i18n("Include &subfolders"), pages[0]);
    caseSensCb  = new QCheckBox(i18n("Case s&ensitive search"), pages[0]);
    browseB    = new QPushButton(i18n("&Browse..."), pages[0]);
    useLocateCb = new QCheckBox(i18n("&Use files index"), pages[0]);
    hiddenFilesCb = new QCheckBox(i18n("Show &hidden files"), pages[0]);
    // Setup

    subdirsCb->setChecked(true);
    caseSensCb->setChecked(false);
    useLocateCb->setChecked(false);
    hiddenFilesCb->setChecked(false);
    if(KStandardDirs::findExe(QLatin1String("locate")).isEmpty())
        useLocateCb->setEnabled(false);

    nameBox->setDuplicatesEnabled(false);
    nameBox->setFocus();
    dirBox->setDuplicatesEnabled(false);

    nameBox->setInsertPolicy(QComboBox::InsertAtTop);
    dirBox->setInsertPolicy(QComboBox::InsertAtTop);

    const QString nameWhatsThis
      = i18n("<qt>Enter the filename you are looking for. <br />"
	     "Alternatives may be separated by a semicolon \";\".<br />"
	     "<br />"
	     "The filename may contain the following special characters:"
	     "<ul>"
	     "<li><b>?</b> matches any single character</li>"
	     "<li><b>*</b> matches zero or more of any characters</li>"
	     "<li><b>[...]</b> matches any of the characters between the braces</li>"
	     "</ul>"
	     "<br />"
	     "Example searches:"
	     "<ul>"
	     "<li><b>*.kwd;*.txt</b> finds all files ending with .kwd or .txt</li>"
	     "<li><b>go[dt]</b> finds god and got</li>"
	     "<li><b>Hel?o</b> finds all files that start with \"Hel\" and end with \"o\", "
	     "having one character in between</li>"
	     "<li><b>My Document.kwd</b> finds a file of exactly that name</li>"
	     "</ul></qt>");
    nameBox->setWhatsThis(nameWhatsThis);
    namedL->setWhatsThis(nameWhatsThis);
    const QString whatsfileindex
        = i18n("<qt>This lets you use the files' index created by the <i>slocate</i> "
               "package to speed-up the search; remember to update the index from time to time "
               "(using <i>updatedb</i>)."
               "</qt>");
    useLocateCb->setWhatsThis(whatsfileindex);

    // Layout

    QGridLayout *grid = new QGridLayout( pages[0] );
    grid->setMargin( KDialog::marginHint() );
    grid->setSpacing( KDialog::spacingHint() );
    QVBoxLayout *subgrid = new QVBoxLayout();
    grid->addWidget( namedL, 0, 0 );
    grid->addWidget( nameBox, 0, 1, 1, 3 );
    grid->addWidget( lookinL, 1, 0 );
    grid->addWidget( dirBox, 1, 1 );
    grid->addWidget( browseB, 1, 2);
    grid->setColumnStretch(1,1);
    grid->addLayout( subgrid, 2, 1, 1, 2 );
    
    QHBoxLayout * layoutOne = new QHBoxLayout();
    layoutOne->addWidget( subdirsCb );
    layoutOne->addWidget( hiddenFilesCb );
    
    QHBoxLayout * layoutTwo = new QHBoxLayout();
    layoutTwo->addWidget( caseSensCb);
    layoutTwo->addWidget( useLocateCb );
    
    subgrid->addLayout( layoutOne );
    subgrid->addLayout( layoutTwo );
    
    subgrid->addStretch(1);

    // Signals

    connect(browseB, &QPushButton::clicked, this, &KfindTabWidget::getDirectory);

    connect(nameBox, static_cast<void (KComboBox::*)()>(&KComboBox::returnPressed), this, &KfindTabWidget::startSearch);

    connect(dirBox, static_cast<void (KUrlComboBox::*)()>(&KUrlComboBox::returnPressed), this, &KfindTabWidget::startSearch);
    
    // ************ Page Two

    pages[1] = new QWidget;
    pages[1]->setObjectName( QLatin1String( "page2" ) );

    findCreated =  new QCheckBox(i18n("Find all files created or &modified:"), pages[1]);
    bg  = new QButtonGroup();
    rb[0] = new QRadioButton(i18n("&between"), pages[1] );
    rb[1] = new QRadioButton(pages[1]); // text set in updateDateLabels
    andL = new QLabel(i18n("and"), pages[1]);
    andL->setObjectName( QLatin1String( "and" ) );
    betweenType = new KComboBox( pages[1] );
    betweenType->setObjectName( QLatin1String( "comboBetweenType" ) );
    betweenType->addItems(QVector<QString>(5).toList()); // texts set in updateDateLabels
    betweenType->setCurrentIndex(1);
    updateDateLabels(1, 1);

    QDate dt = KLocale::global()->calendar()->addYears(QDate::currentDate(), -1);

    fromDate = new KDateCombo(dt, pages[1] );
    fromDate->setObjectName( QLatin1String( "fromDate" ) );
    toDate = new KDateCombo(pages[1] );
    toDate->setObjectName( QLatin1String( "toDate" ) );
    timeBox = new KIntSpinBox( pages[1] );
    timeBox->setRange( 1, 60 );
    timeBox->setSingleStep( 1 );
    timeBox->setObjectName( QLatin1String( "timeBox" ) );

    sizeBox =new KComboBox( pages[1] );
    sizeBox->setObjectName( QLatin1String( "sizeBox" ) );
    QLabel * sizeL   =new QLabel(i18n("File &size is:"), pages[1]);
    sizeL->setBuddy( sizeBox );
    sizeEdit=new KIntSpinBox(pages[1] );
    sizeEdit->setRange( 0, INT_MAX );
    sizeEdit->setSingleStep( 1 );
    sizeEdit->setObjectName( QLatin1String( "sizeEdit" ) );
    sizeEdit->setValue(1);
    sizeUnitBox =new KComboBox( pages[1] );
    sizeUnitBox->setObjectName( QLatin1String( "sizeUnitBox" ) );

    m_usernameBox = new KComboBox( pages[1] );
    m_usernameBox->setEditable( true );
    m_usernameBox->setObjectName( QLatin1String( "m_combo1" ));
    QLabel *usernameLabel= new QLabel(i18n("Files owned by &user:"******"m_combo2" ) );
    QLabel *groupLabel= new QLabel(i18n("Owned by &group:"),pages[1]);
    groupLabel->setBuddy( m_groupBox );

    sizeBox ->addItem( i18nc("file size isn't considered in the search","(none)") );
    sizeBox ->addItem( i18n("At Least") );
    sizeBox ->addItem( i18n("At Most") );
    sizeBox ->addItem( i18n("Equal To") );

    sizeUnitBox ->addItem( i18np("Byte", "Bytes", 1) );
    sizeUnitBox ->addItem( i18n("KiB") );
    sizeUnitBox ->addItem( i18n("MiB") );
    sizeUnitBox ->addItem( i18n("GiB") );
    sizeUnitBox ->setCurrentIndex(1);

    int tmp = sizeEdit->fontMetrics().width(QLatin1String(" 000000000 "));
    sizeEdit->setMinimumSize(tmp, sizeEdit->sizeHint().height());

    m_usernameBox->setDuplicatesEnabled(false);
    m_groupBox->setDuplicatesEnabled(false);
    m_usernameBox->setInsertPolicy(QComboBox::InsertAtTop);
    m_groupBox->setInsertPolicy(QComboBox::InsertAtTop);


    // Setup
    rb[0]->setChecked(true);
    bg->addButton( rb[0] );
    bg->addButton( rb[1] );

    // Layout

    QGridLayout *grid1 = new QGridLayout( pages[1] );
    grid1->setMargin( KDialog::marginHint() );
    grid1->setSpacing( KDialog::spacingHint() );

    grid1->addWidget(findCreated, 0, 0, 1, 3 );
    grid1->addItem( new QSpacerItem(KDialog::spacingHint(), 0), 0, 0 );

    grid1->addWidget(rb[0], 1, 1 );
    grid1->addWidget(fromDate, 1, 2 );
    grid1->addWidget(andL, 1, 3, Qt::AlignHCenter );
    grid1->addWidget(toDate, 1, 4 );

    grid1->addWidget(rb[1], 2, 1 );
    grid1->addWidget(timeBox, 2, 2, 1, 2);
    grid1->addWidget(betweenType, 2, 4 );

    grid1->addWidget(sizeL,3,0,1,2);
    grid1->addWidget(sizeBox,3,2);
    grid1->addWidget(sizeEdit,3,3);
    grid1->addWidget(sizeUnitBox,3,4);

    grid1->addWidget(usernameLabel,4,0,1,2);
    grid1->addWidget(m_usernameBox,4,2);
    grid1->addWidget(groupLabel,4,3);
    grid1->addWidget(m_groupBox,4,4);

    for (int c=1; c<=4; c++)
       grid1->setColumnStretch(c,1);

    grid1->setRowStretch(6,1);

    // Connect
    connect(findCreated, &QCheckBox::toggled, this, &KfindTabWidget::fixLayout);
    connect(bg, static_cast<void (QButtonGroup::*)(QAbstractButton *)>(&QButtonGroup::buttonClicked), this, &KfindTabWidget::fixLayout);
    connect(sizeBox, static_cast<void (KComboBox::*)(int)>(&KComboBox::activated), this, &KfindTabWidget::slotSizeBoxChanged);
    connect(timeBox, static_cast<void (KIntSpinBox::*)(int)>(&KIntSpinBox::valueChanged), this, &KfindTabWidget::slotUpdateDateLabelsForNumber);
    connect(betweenType, static_cast<void (KComboBox::*)(int)>(&KComboBox::currentIndexChanged), this, &KfindTabWidget::slotUpdateDateLabelsForType);
    connect(sizeEdit, static_cast<void (KIntSpinBox::*)(int)>(&KIntSpinBox::valueChanged), this, &KfindTabWidget::slotUpdateByteComboBox);


    // ************ Page Three

    pages[2] = new QWidget;
    pages[2]->setObjectName( QLatin1String( "page3" ) );

    typeBox =new KComboBox( pages[2] );
    typeBox->setObjectName( QLatin1String( "typeBox" ) );
    typeBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);  // allow smaller than widest entry
    QLabel * typeL   =new QLabel( i18nc("label for the file type combobox","File &type:"), pages[2] );
    typeL->setBuddy( typeBox );
    textEdit=new KLineEdit(pages[2]);
    textEdit->setClearButtonShown(true);
    textEdit->setObjectName( QLatin1String( "textEdit" ) );
    QLabel * textL   =new QLabel(i18n("C&ontaining text:"), pages[2]);
    textL->setBuddy( textEdit );

    connect(textEdit, &KLineEdit::returnPressed, this, &KfindTabWidget::startSearch);

    const QString containingtext
      = i18n("<qt>If specified, only files that contain this text"
	      " are found. Note that not all file types from the list"
		  " above are supported. Please refer to the documentation"
		  " for a list of supported file types."
	      "</qt>");
    textEdit->setToolTip(containingtext);
    textL->setWhatsThis(containingtext);

    caseContextCb  =new QCheckBox(i18n("Case s&ensitive"), pages[2]);
    binaryContextCb  =new QCheckBox(i18n("Include &binary files"), pages[2]);
    regexpContentCb  =new QCheckBox(i18n("Regular e&xpression"), pages[2]);

    const QString binaryTooltip
      = i18n("<qt>This lets you search in any type of file, "
       "even those that usually do not contain text (for example "
	   "program files and images).</qt>");
    binaryContextCb->setToolTip(binaryTooltip);

    QPushButton* editRegExp = 0;
    if ( !KServiceTypeTrader::self()->query(QStringLiteral("KRegExpEditor/KRegExpEditor")).isEmpty() ) {
        // The editor is available, so lets use it.
        editRegExp = new QPushButton(i18n("&Edit..."), pages[2]);
        editRegExp->setObjectName( QLatin1String( "editRegExp" ) );
    }

    metainfokeyEdit=new KLineEdit(pages[2]);
    metainfoEdit=new KLineEdit(pages[2]);
    QLabel * textMetaInfo = new QLabel(i18nc("as in search for", "fo&r:"), pages[2]);
    textMetaInfo->setBuddy( metainfoEdit );
    QLabel * textMetaKey = new QLabel(i18n("Search &metainfo sections:"), pages[2]);
    textMetaKey->setBuddy( metainfokeyEdit );

    // Setup
    typeBox->addItem(i18n("All Files & Folders"));
    typeBox->addItem(i18n("Files"));
    typeBox->addItem(i18n("Folders"));
    typeBox->addItem(i18n("Symbolic Links"));
    typeBox->addItem(i18n("Special Files (Sockets, Device Files, ...)"));
    typeBox->addItem(i18n("Executable Files"));
    typeBox->addItem(i18n("SUID Executable Files"));
    typeBox->addItem(i18n("All Images"));
    typeBox->addItem(i18n("All Video"));
    typeBox->addItem(i18n("All Sounds"));

    initMimeTypes();
    initSpecialMimeTypes();

    for ( KMimeType::List::ConstIterator it = m_types.constBegin();
          it != m_types.constEnd(); ++it )
    {
      KMimeType::Ptr typ = *it;
// TODO: needs to move to thread (increases startup time to bizzare amount)
//       and replaced with a better concept 16x16 icons don't cut the cheese
//       typeBox->addItem(KIconLoader::global()->loadMimeTypeIcon( typ->iconName(), KIconLoader::Small ), typ->comment());
      typeBox->addItem(typ->comment());
    }

    if ( editRegExp ) {
      // The editor was available, so lets use it.
      connect(regexpContentCb, &QCheckBox::toggled, editRegExp, &QPushButton::setEnabled);
      editRegExp->setEnabled(false);
      connect(editRegExp, &QPushButton::clicked, this, &KfindTabWidget::slotEditRegExp);
    }
    else
        regexpContentCb->hide();

    // Layout
    tmp = sizeEdit->fontMetrics().width(QLatin1String(" 00000 "));
    sizeEdit->setMinimumSize(tmp, sizeEdit->sizeHint().height());

    QGridLayout *grid2 = new QGridLayout( pages[2] );
    grid2->setMargin( KDialog::marginHint() );
    grid2->setSpacing( KDialog::spacingHint() );
    grid2->addWidget( typeL, 0, 0 );
    grid2->addWidget( textL, 1, 0 );
    grid2->addWidget( typeBox, 0, 1, 1, 3 );
    grid2->addWidget( textEdit, 1, 1, 1, 3 );
    grid2->addWidget( regexpContentCb, 2, 2);
    grid2->addWidget( caseContextCb, 2, 1 );
    grid2->addWidget( binaryContextCb, 3, 1);

    grid2->addWidget( textMetaKey, 4, 0 );
    grid2->addWidget( metainfokeyEdit, 4, 1 );
    grid2->addWidget( textMetaInfo, 4, 2, Qt::AlignHCenter  );
    grid2->addWidget( metainfoEdit, 4, 3 );

    metainfokeyEdit->setText(QLatin1String("*"));

    if ( editRegExp ) {
      // The editor was available, so lets use it.
      grid2->addWidget( editRegExp, 2, 3 );
    }

    addTab( pages[0], i18n("Name/&Location") );
    addTab( pages[2], i18nc("tab name: search by contents","C&ontents") );
    addTab( pages[1], i18n("&Properties") );


    // Setup
    const QString whatsmetainfo
      = i18n("<qt>Search within files' specific comments/metainfo<br />"
	     "These are some examples:<br />"
	     "<ul>"
	     "<li><b>Audio files (mp3...)</b> Search in id3 tag for a title, an album</li>"
	     "<li><b>Images (png...)</b> Search images with a special resolution, comment...</li>"
	     "</ul>"
	     "</qt>");
    const QString whatsmetainfokey
      = i18n("<qt>If specified, search only in this field<br />"
	     "<ul>"
	     "<li><b>Audio files (mp3...)</b> This can be Title, Album...</li>"
	     "<li><b>Images (png...)</b> Search only in Resolution, Bitdepth...</li>"
	     "</ul>"
	     "</qt>");
    textMetaInfo->setWhatsThis(whatsmetainfo);
    metainfoEdit->setToolTip(whatsmetainfo);
    textMetaKey->setWhatsThis(whatsmetainfokey);
    metainfokeyEdit->setToolTip(whatsmetainfokey);


    fixLayout();
    loadHistory();
}
コード例 #9
0
ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) :
    QFrame(parent),
    m_itemIconSize(24, 24),
    m_resIconSize(24, 24),
    m_iconProvider(m_resIconSize),
    m_itemViewQuickWidget(new QQuickWidget),
    m_resourcesView(new ItemLibraryTreeView(this)),
    m_filterFlag(QtBasic)
{
    ItemLibraryModel::registerQmlTypes();

    setWindowTitle(tr("Library", "Title of library view"));

    /* create Items view and its model */
    m_itemViewQuickWidget->setResizeMode(QQuickWidget::SizeRootObjectToView);
    m_itemLibraryModel = new ItemLibraryModel(this);

    QQmlContext *rootContext = m_itemViewQuickWidget->rootContext();
    rootContext->setContextProperty(QStringLiteral("itemLibraryModel"), m_itemLibraryModel.data());
    rootContext->setContextProperty(QStringLiteral("itemLibraryIconWidth"), m_itemIconSize.width());
    rootContext->setContextProperty(QStringLiteral("itemLibraryIconHeight"), m_itemIconSize.height());
    rootContext->setContextProperty(QStringLiteral("rootView"), this);

    m_itemViewQuickWidget->rootContext()->setContextProperty(QStringLiteral("highlightColor"), Utils::StyleHelper::notTooBrightHighlightColor());

    /* create Resources view and its model */
    m_resourcesFileSystemModel = new QFileSystemModel(this);
    m_resourcesFileSystemModel->setIconProvider(&m_iconProvider);
    m_resourcesView->setModel(m_resourcesFileSystemModel.data());
    m_resourcesView->setIconSize(m_resIconSize);

    /* create image provider for loading item icons */
    m_itemViewQuickWidget->engine()->addImageProvider(QStringLiteral("qmldesigner_itemlibrary"), new Internal::ItemLibraryImageProvider);

    /* other widgets */
    QTabBar *tabBar = new QTabBar(this);
    tabBar->addTab(tr("QML Types", "Title of library QML types view"));
    tabBar->addTab(tr("Resources", "Title of library resources view"));
    tabBar->addTab(tr("Imports", "Title of library imports view"));
    tabBar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    connect(tabBar, SIGNAL(currentChanged(int)), this, SLOT(setCurrentIndexOfStackedWidget(int)));
    connect(tabBar, SIGNAL(currentChanged(int)), this, SLOT(updateSearch()));

    m_filterLineEdit = new Utils::FancyLineEdit(this);
    m_filterLineEdit->setObjectName(QStringLiteral("itemLibrarySearchInput"));
    m_filterLineEdit->setPlaceholderText(tr("<Filter>", "Library search input hint text"));
    m_filterLineEdit->setDragEnabled(false);
    m_filterLineEdit->setMinimumWidth(75);
    m_filterLineEdit->setTextMargins(0, 0, 20, 0);
    m_filterLineEdit->setFiltering(true);
    QWidget *lineEditFrame = new QWidget(this);
    lineEditFrame->setObjectName(QStringLiteral("itemLibrarySearchInputFrame"));
    QGridLayout *lineEditLayout = new QGridLayout(lineEditFrame);
    lineEditLayout->setMargin(2);
    lineEditLayout->setSpacing(0);
    lineEditLayout->addItem(new QSpacerItem(5, 3, QSizePolicy::Fixed, QSizePolicy::Fixed), 0, 0, 1, 3);
    lineEditLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Fixed, QSizePolicy::Fixed), 1, 0);
    lineEditLayout->addWidget(m_filterLineEdit.data(), 1, 1, 1, 1);
    lineEditLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Fixed, QSizePolicy::Fixed), 1, 2);
    connect(m_filterLineEdit.data(), SIGNAL(filterChanged(QString)), this, SLOT(setSearchFilter(QString)));


    m_stackedWidget = new QStackedWidget(this);
    m_stackedWidget->addWidget(m_itemViewQuickWidget.data());
    m_stackedWidget->addWidget(m_resourcesView.data());

    QWidget *spacer = new QWidget(this);
    spacer->setObjectName(QStringLiteral("itemLibrarySearchInputSpacer"));
    spacer->setFixedHeight(4);

    QGridLayout *layout = new QGridLayout(this);
    layout->setContentsMargins(0, 0, 0, 0);
    layout->setSpacing(0);
    layout->addWidget(tabBar, 0, 0, 1, 1);
    layout->addWidget(spacer, 1, 0);
    layout->addWidget(lineEditFrame, 2, 0, 1, 1);
    layout->addWidget(m_stackedWidget.data(), 3, 0, 1, 1);

    setResourcePath(QDir::currentPath());
    setSearchFilter(QString());

    /* style sheets */
    setStyleSheet(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/stylesheet.css"))));
    m_resourcesView->setStyleSheet(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/scrollbar.css"))));

    m_qmlSourceUpdateShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_F5), this);
    connect(m_qmlSourceUpdateShortcut, SIGNAL(activated()), this, SLOT(reloadQmlSource()));

    // init the first load of the QML UI elements
    reloadQmlSource();
}
コード例 #10
0
void TilesetItemBox::makeSelectedTileset(int tabIndex)
{
    if(lockTilesetBox)
        return;

    QGraphicsScene *scene = NULL;

    LevelEdit *lvlEdit = mw()->activeLvlEditWin();
    WorldEdit *wldEdit = mw()->activeWldEditWin();

    if((lvlEdit) && (lvlEdit->sceneCreated))
        scene = lvlEdit->scene;
    else if((wldEdit) && (wldEdit->sceneCreated))
        scene = wldEdit->scene;

    QTabWidget *cat = ui->TileSetsCategories;
    if(!(cat->tabText(tabIndex) == "Custom"))
    {
        QWidget *current = cat->widget(tabIndex);
        if(!current)
            return;

        QString category = cat->tabText(tabIndex);

        #ifdef _DEBUG_
        DevConsole::log(QString("Category %1").arg(cat->tabText(cat->currentIndex())), "Debug");
        #endif

        QScrollArea *currentFrame   = getFrameTilesetOfTab(current);
        QComboBox   *currentCombo   = getGroupComboboxOfTab(current);
        if(!currentFrame || !currentCombo)
            return;

        QWidget *scrollWid = currentFrame->widget();
        if(!scrollWid)
            return;

        qDeleteAll(scrollWid->findChildren<QGroupBox *>());

        if(scrollWid->layout() == 0)
            scrollWid->setLayout(new FlowLayout());

        currentFrame->setWidgetResizable(true);

        #ifdef _DEBUG_
        DevConsole::log(QString("size %1 %2")
                        .arg(scrollWid->layout()->geometry().width())
                        .arg(scrollWid->layout()->geometry().height())
                        , "Debug");
        #endif

        QString currentGroup = currentCombo->currentText();
        for(int i = 0; i < mw()->configs.main_tilesets_grp.size(); i++)
        {
            if((mw()->configs.main_tilesets_grp[i].groupCat == category)
               && (mw()->configs.main_tilesets_grp[i].groupName == currentGroup)) //category
            {
                #ifdef _DEBUG_
                DevConsole::log(QString("Group %1").arg(configs.main_tilesets_grp[i].groupName), "Debug");
                DevConsole::log(QString("Tilesets %1").arg(configs.main_tilesets_grp[i].tilesets.size()), "Debug");
                #endif

                QStringList l = mw()->configs.main_tilesets_grp[i].tilesets;
                foreach(QString s, l)
                {
                    for(int j = 0; j < mw()->configs.main_tilesets.size(); j++)
                    {
                        if(s == mw()->configs.main_tilesets[j].fileName)
                        {
                            SimpleTileset &s = mw()->configs.main_tilesets[j];
                            QGroupBox *tilesetNameWrapper = new QGroupBox(s.tileSetName, scrollWid);
                            ((FlowLayout *)scrollWid->layout())->addWidget(tilesetNameWrapper);
                            QGridLayout *l = new QGridLayout(tilesetNameWrapper);
                            l->setContentsMargins(4, 4, 4, 4);
                            l->setSpacing(2);
                            for(int k = 0; k < s.items.size(); k++)
                            {
                                SimpleTilesetItem &item = s.items[k];
                                TilesetItemButton *tbutton = new TilesetItemButton(&mw()->configs, scene, tilesetNameWrapper);
                                tbutton->applySize(32, 32);
                                tbutton->applyItem(s.type, item.id);
                                l->addWidget(tbutton, item.row, item.col);
                                connect(tbutton, SIGNAL(clicked(int, ulong)), mw(), SLOT(SwitchPlacingItem(int, ulong)));
                            }
                            break;
                        }
                    }
                }
                break;
            }
        }
コード例 #11
0
QvisText3DInterface::QvisText3DInterface(QWidget *parent) : 
    QvisAnnotationObjectInterface(parent)
{
    // Set the title of the group box.
    this->setTitle(GetName());

    QGridLayout *cLayout = new QGridLayout(0);
    topLayout->addLayout(cLayout);
    cLayout->setSpacing(10);

    int row = 0;

    // Add controls for entering the text
    textLineEdit = new QLineEdit(this);
    connect(textLineEdit, SIGNAL(returnPressed()),
            this, SLOT(textChanged()));
    cLayout->addWidget(textLineEdit, row, 1, 1, 2);
    cLayout->addWidget(new QLabel(tr("Text"), this), row, 0);
    ++row;

    // Add controls for the position
    positionEdit = new QLineEdit(this);
    connect(positionEdit, SIGNAL(returnPressed()),
            this, SLOT(positionChanged()));
    cLayout->addWidget(positionEdit, row, 1, 1, 2);
    cLayout->addWidget(new QLabel(tr("Position"), this), row, 0);
    ++row;

    // Add controls for the height.
    heightMode = new QButtonGroup(this);
    connect(heightMode, SIGNAL(buttonClicked(int)),
            this, SLOT(heightModeChanged(int)));
    cLayout->addWidget(new QLabel(tr("Height"), this), row, 0);
    QRadioButton *rb = new QRadioButton(tr("Relative"), this);
    heightMode->addButton(rb, 0);
    cLayout->addWidget(rb, row, 1);
    // Add controls for relative height
    relativeHeightSpinBox = new QSpinBox(this);
    relativeHeightSpinBox->setMinimum(1);
    relativeHeightSpinBox->setMaximum(100);
    relativeHeightSpinBox->setSuffix("%");
    relativeHeightSpinBox->setButtonSymbols(QSpinBox::PlusMinus);
    connect(relativeHeightSpinBox, SIGNAL(valueChanged(int)),
            this, SLOT(relativeHeightChanged(int)));
    cLayout->addWidget(relativeHeightSpinBox, row, 2);
    ++row;

    // Add controls for fixed height.
    rb = new QRadioButton(tr("Fixed"), this);
    heightMode->addButton(rb, 1);
    cLayout->addWidget(rb, row, 1);
    fixedHeightEdit = new QLineEdit(this);
    connect(fixedHeightEdit, SIGNAL(returnPressed()),
            this, SLOT(fixedHeightChanged()));
    cLayout->addWidget(fixedHeightEdit, row, 2);
    cLayout->setColumnStretch(2, 10);
    ++row;

    QFrame *splitter1 = new QFrame(this);
    splitter1->setFrameStyle(QFrame::HLine + QFrame::Raised);
    cLayout->addWidget(splitter1, row, 0, 1, 3);
    ++row;

    facesCameraCheckBox = new QCheckBox(tr("Preserve orientation when view changes"), this);
    connect(facesCameraCheckBox, SIGNAL(toggled(bool)),
            this, SLOT(facesCameraToggled(bool)));
    cLayout->addWidget(facesCameraCheckBox, row, 0, 1, 3);
    ++row;

    rotateZ = new QSpinBox(this);
    rotateZ->setMinimum(-360);
    rotateZ->setMaximum(360);
    rotateZ->setButtonSymbols(QSpinBox::PlusMinus);
    rotateZ->setSuffix(" deg");
    connect(rotateZ, SIGNAL(valueChanged(int)),
            this, SLOT(rotateZChanged(int)));
    QLabel *rotateZLabel = new QLabel(tr("Rotate Z"), this);
    rotateX = new QSpinBox(this);
    rotateX->setMinimum(-360);
    rotateX->setMaximum(360);
    rotateX->setButtonSymbols(QSpinBox::PlusMinus);
    rotateX->setSuffix(" deg");
    connect(rotateX, SIGNAL(valueChanged(int)),
            this, SLOT(rotateXChanged(int)));
    QLabel *rotateXLabel = new QLabel(tr("Rotate X"), this);
    rotateY = new QSpinBox(this);
    rotateY->setMinimum(-360);
    rotateY->setMaximum(360);
    rotateY->setButtonSymbols(QSpinBox::PlusMinus);
    rotateY->setSuffix(" deg");
    connect(rotateY, SIGNAL(valueChanged(int)),
            this, SLOT(rotateYChanged(int)));
    QLabel *rotateYLabel = new QLabel(tr("Rotate Y"), this);
    QGridLayout *rLayout = new QGridLayout(0);
    rLayout->setMargin(0);
    cLayout->addLayout(rLayout, row, 0, 1, 3);
    rLayout->addWidget(rotateYLabel, 0, 0);
    rLayout->addWidget(rotateXLabel, 0, 1);
    rLayout->addWidget(rotateZLabel, 0, 2);
    rLayout->addWidget(rotateY, 1, 0);
    rLayout->addWidget(rotateX, 1, 1);
    rLayout->addWidget(rotateZ, 1, 2);
    ++row;

    QFrame *splitter2 = new QFrame(this);
    splitter2->setFrameStyle(QFrame::HLine + QFrame::Raised);
    cLayout->addWidget(splitter2, row, 0, 1, 4);
    ++row;

    // Add controls for the text color.
    textColorButton = new QvisColorButton(this);
    connect(textColorButton, SIGNAL(selectedColor(const QColor &)),
            this, SLOT(textColorChanged(const QColor &)));
    cLayout->addWidget(new QLabel(tr("Text color")), row, 0, Qt::AlignLeft);
    cLayout->addWidget(textColorButton, row, 1);
    textColorOpacity = new QvisOpacitySlider(0, 255, 10, 0, this);
    connect(textColorOpacity, SIGNAL(valueChanged(int)),
            this, SLOT(textOpacityChanged(int)));
    cLayout->addWidget(textColorOpacity, row, 2, 1, 2);
    ++row;

    // Added a use foreground toggle
    useForegroundColorCheckBox = new QCheckBox(tr("Use foreground color"), this);
    connect(useForegroundColorCheckBox, SIGNAL(toggled(bool)),
            this, SLOT(useForegroundColorToggled(bool)));
    cLayout->addWidget(useForegroundColorCheckBox, row, 0, 1, 3);
    ++row;

    // Added a visibility toggle
    visibleCheckBox = new QCheckBox(tr("Visible"), this);
    connect(visibleCheckBox, SIGNAL(toggled(bool)),
            this, SLOT(visibilityToggled(bool)));
    cLayout->addWidget(visibleCheckBox, row, 0);
}
コード例 #12
0
/**
 * Sets up the dialog.
 */
void UMLOperationDialog::setupDialog()
{
    QFrame *frame = new QFrame(this);
    setMainWidget(frame);
    int margin = fontMetrics().height();
    QVBoxLayout * topLayout = new QVBoxLayout(frame);

    m_pGenGB = new QGroupBox(i18n("General Properties"), frame);
    QGridLayout * genLayout = new QGridLayout(m_pGenGB);
    genLayout->setColumnStretch(1, 1);
    genLayout->setColumnStretch(3, 1);
    genLayout->addItem(new QSpacerItem(200, 0), 0, 1);
    genLayout->addItem(new QSpacerItem(200, 0), 0, 3);
    genLayout->setMargin(margin);
    genLayout->setSpacing(10);

    Dialog_Utils::makeLabeledEditField(genLayout, 0,
                                    m_pNameL, i18nc("operation name", "&Name:"),
                                    m_pNameLE, m_operation->name());

    m_pRtypeL = new QLabel(i18n("&Type:"), m_pGenGB);
    genLayout->addWidget(m_pRtypeL, 0, 2);

    m_pRtypeCB = new KComboBox(true, m_pGenGB);
    genLayout->addWidget(m_pRtypeCB, 0, 3);
    m_pRtypeL->setBuddy(m_pRtypeCB);

    m_stereotypeWidget = new UMLStereotypeWidget(m_operation);
    m_stereotypeWidget->addToLayout(genLayout, 1);

    m_pAbstractCB = new QCheckBox(i18n("&Abstract operation"), m_pGenGB);
    m_pAbstractCB->setChecked(m_operation->isAbstract());
    genLayout->addWidget(m_pAbstractCB, 2, 0);
    m_pStaticCB = new QCheckBox(i18n("Classifier &scope (\"static\")"), m_pGenGB);
    m_pStaticCB->setChecked(m_operation->isStatic());
    genLayout->addWidget(m_pStaticCB, 2, 1);
    m_pQueryCB = new QCheckBox(i18n("&Query (\"const\")"), m_pGenGB);
    m_pQueryCB->setChecked(m_operation->getConst());
    genLayout->addWidget(m_pQueryCB, 2, 2);

    m_visibilityEnumWidget = new VisibilityEnumWidget(m_operation, this);

    m_docWidget = new DocumentationWidget(m_operation, this);

    m_pParmsGB = new QGroupBox(i18n("Parameters"), frame);
    QVBoxLayout* parmsLayout = new QVBoxLayout(m_pParmsGB);
    parmsLayout->setMargin(margin);
    parmsLayout->setSpacing(10);

    // horizontal box contains the list box and the move up/down buttons
    QHBoxLayout* parmsHBoxLayout = new QHBoxLayout();
    m_pParmsLW = new QListWidget(m_pParmsGB);
    m_pParmsLW->setContextMenuPolicy(Qt::CustomContextMenu);

    // the move up/down buttons (another vertical box)
    QVBoxLayout* buttonLayout = new QVBoxLayout();

    m_pUpButton = new QToolButton(m_pParmsGB);
    m_pUpButton->setArrowType(Qt::UpArrow);
    m_pUpButton->setEnabled(false);
    buttonLayout->addWidget(m_pUpButton);

    m_pDownButton = new QToolButton(m_pParmsGB);
    m_pDownButton->setArrowType(Qt::DownArrow);
    m_pDownButton->setEnabled(false);
    buttonLayout->addWidget(m_pDownButton);

    KDialogButtonBox* buttonBox = new KDialogButtonBox(m_pParmsGB);
    buttonBox->addButton(i18n("Ne&w Parameter..."), KDialogButtonBox::ActionRole,
                          this, SLOT(slotNewParameter()));
    m_pDeleteButton = buttonBox->addButton(i18n("&Delete"), KDialogButtonBox::ActionRole,
                                            this, SLOT(slotDeleteParameter()));
    m_pPropertiesButton = buttonBox->addButton(i18n("&Properties"), KDialogButtonBox::ActionRole,
                          this, SLOT(slotParameterProperties()));

    parmsHBoxLayout->addWidget(m_pParmsLW);
    parmsHBoxLayout->addLayout(buttonLayout);

    parmsLayout->addLayout(parmsHBoxLayout);
    parmsLayout->addWidget(buttonBox);

    topLayout->addWidget(m_pGenGB);
    topLayout->addWidget(m_visibilityEnumWidget);
    topLayout->addWidget(m_docWidget);
    topLayout->addWidget(m_pParmsGB);

    m_pDeleteButton->setEnabled(false);
    m_pPropertiesButton->setEnabled(false);
    m_pUpButton->setEnabled(false);
    m_pDownButton->setEnabled(false);

    m_pRtypeCB->setDuplicatesEnabled(false); // only allow one of each type in box
    m_pRtypeCB->setCompletionMode(KGlobalSettings::CompletionPopup);
    // add the return types
    insertTypesSorted(m_operation->getTypeName());

    // fill in parm list box
    UMLAttributeList list = m_operation->getParmList();
    foreach (UMLAttribute* pAtt, list) {
        m_pParmsLW->addItem(pAtt->toString(Uml::SignatureType::SigNoVis));
    }
コード例 #13
0
ファイル: toolsbar.cpp プロジェクト: hfiguiere/rolisteam
void ToolsBar::createTools()
{
    // Creationm_actionGroup des boutons du toolBar
    m_actionGroup = new QActionGroup(this);
    QToolButton *penButton     = new QToolButton(m_mainWidget);
    QToolButton *LineButton      = new QToolButton(m_mainWidget);
    QToolButton *emptyRectButton   = new QToolButton(m_mainWidget);
    QToolButton *filledRectButton  = new QToolButton(m_mainWidget);
    QToolButton *emptyEllipseButton   = new QToolButton(m_mainWidget);
    QToolButton *FilledEllipseButton  = new QToolButton(m_mainWidget);
    QToolButton *textButton      = new QToolButton(m_mainWidget);
    QToolButton *handButton       = new QToolButton(m_mainWidget);
    QToolButton *addNpcButton   = new QToolButton(m_mainWidget);
    QToolButton *delNpcButton   = new QToolButton(m_mainWidget);
    QToolButton *moveNpcButton = new QToolButton(m_mainWidget);
    QToolButton *stateNpcButton    = new QToolButton(m_mainWidget);
    QToolButton *resetNumberButton  = new QToolButton(m_mainWidget);

	// Association des boutons avec les actions
    penButton     ->setDefaultAction(m_pencilAct);
    LineButton      ->setDefaultAction(m_lineAct);
    emptyRectButton   ->setDefaultAction(m_rectAct);
    filledRectButton  ->setDefaultAction(m_filledRectAct);
    emptyEllipseButton   ->setDefaultAction(m_ellipseAct);
    FilledEllipseButton  ->setDefaultAction(m_filledEllipseAct);
    textButton      ->setDefaultAction(m_textAct);
    handButton       ->setDefaultAction(m_handAct);
    addNpcButton   ->setDefaultAction(m_addNpcAct);
    delNpcButton   ->setDefaultAction(m_delNpcAct);
    moveNpcButton ->setDefaultAction(m_moveCharacterAct);
    stateNpcButton    ->setDefaultAction(m_changeCharacterState);
    resetNumberButton  ->setDefaultAction(m_resetCountAct);


	m_actionGroup->addAction(m_pencilAct);
	m_actionGroup->addAction(m_lineAct);
	m_actionGroup->addAction(m_rectAct);
	m_actionGroup->addAction(m_filledRectAct);
	m_actionGroup->addAction(m_ellipseAct);
	m_actionGroup->addAction(m_filledEllipseAct);
	m_actionGroup->addAction(m_textAct);

	m_actionGroup->addAction(m_handAct);
	m_actionGroup->addAction(m_addNpcAct);
	m_actionGroup->addAction(m_delNpcAct);
	m_actionGroup->addAction(m_moveCharacterAct);
	m_actionGroup->addAction(m_changeCharacterState);
    //m_actionGroup->addAction(actionRazChrono);

    connect(m_actionGroup,SIGNAL(triggered(QAction*)),this,SLOT(currentToolHasChanged(QAction*)));

	// Boutons en mode AutoRaise, plus lisible
    penButton->setAutoRaise(true);
    LineButton->setAutoRaise(true);
    emptyRectButton->setAutoRaise(true);
    filledRectButton->setAutoRaise(true);
    emptyEllipseButton->setAutoRaise(true);
    FilledEllipseButton->setAutoRaise(true);
    textButton->setAutoRaise(true);
    handButton->setAutoRaise(true);
    addNpcButton->setAutoRaise(true);
    delNpcButton->setAutoRaise(true);
    moveNpcButton->setAutoRaise(true);
    stateNpcButton->setAutoRaise(true);
    resetNumberButton->setAutoRaise(true);
	
	// Changement de la taille des icones
	QSize tailleIcones(DEFAULT_ICON_SIZE,DEFAULT_ICON_SIZE);
    penButton     ->setIconSize(tailleIcones);
    LineButton      ->setIconSize(tailleIcones);
    emptyRectButton   ->setIconSize(tailleIcones);
    filledRectButton  ->setIconSize(tailleIcones);
    emptyEllipseButton   ->setIconSize(tailleIcones);
    FilledEllipseButton  ->setIconSize(tailleIcones);
    textButton      ->setIconSize(tailleIcones);
    handButton       ->setIconSize(tailleIcones);
    addNpcButton   ->setIconSize(tailleIcones);
    delNpcButton   ->setIconSize(tailleIcones);
    moveNpcButton ->setIconSize(tailleIcones);
    stateNpcButton    ->setIconSize(tailleIcones);
    resetNumberButton  ->setIconSize(tailleIcones);
				
	// Creation du layout vertical qui constitue la barre d'outils
    QVBoxLayout *outilsLayout = new QVBoxLayout(m_mainWidget);
	outilsLayout->setSpacing(0);
	outilsLayout->setMargin(2);

	// Creation du layout qui contient les outils de dessin
	QGridLayout *layoutDessin = new QGridLayout();
	layoutDessin->setSpacing(0);
	layoutDessin->setMargin(0);
    layoutDessin->addWidget(penButton, 0, 0);
    layoutDessin->addWidget(LineButton, 0, 1);
    layoutDessin->addWidget(emptyRectButton, 1, 0);
    layoutDessin->addWidget(filledRectButton, 1, 1);
    layoutDessin->addWidget(emptyEllipseButton, 2, 0);
    layoutDessin->addWidget(FilledEllipseButton, 2, 1);
    layoutDessin->addWidget(textButton, 3, 0);
    layoutDessin->addWidget(handButton, 3, 1);

	// Creation des zones de texte et de nom de PNJ
    m_textEdit = new QLineEdit(m_mainWidget);
    m_textEdit->setToolTip(tr("Text"));

    m_npcNameEdit = new QLineEdit(m_mainWidget);
    m_npcNameEdit->setToolTip(tr("NPC name"));
	
	// Creation de l'afficheur du numero de PNJ
    m_showPnjNumber = new QLCDNumber(2, m_mainWidget);
    m_showPnjNumber->setSegmentStyle(QLCDNumber::Flat);
    m_showPnjNumber->setMaximumSize(DEFAULT_ICON_SIZE + 7, DEFAULT_ICON_SIZE);
    m_showPnjNumber->display(1);
    m_showPnjNumber->setToolTip(tr("NPC Number"));

	m_currentNpcNumber = 1;
	
    // Creation du selecteur de m_color
    m_color = new ColorSelector(m_mainWidget);

	// Creation du layout contient les outils de deplcement des PNJ
	QHBoxLayout *layoutMouvementPnj = new QHBoxLayout();
	layoutMouvementPnj->setSpacing(0);
	layoutMouvementPnj->setMargin(0);
    layoutMouvementPnj->addWidget(moveNpcButton);
    layoutMouvementPnj->addWidget(stateNpcButton);

	// Creation du layout contient les outils d'ajout et de suppression des PNJ
	QGridLayout *layoutAjoutPnj = new QGridLayout();
	layoutAjoutPnj->setSpacing(0);
	layoutAjoutPnj->setMargin(0);
    layoutAjoutPnj->addWidget(addNpcButton, 0, 0);
    layoutAjoutPnj->addWidget(delNpcButton, 0, 1);
    layoutAjoutPnj->addWidget(resetNumberButton, 1, 0);
    layoutAjoutPnj->addWidget(m_showPnjNumber, 1, 1, Qt::AlignHCenter);
	
	// Creation du selecteur de diametre du trait
    m_lineDiameter = new DiameterSelector(m_mainWidget, true, 1, 45);
	m_lineDiameter->setToolTip(tr("Line's Width"));
	connect(m_lineDiameter,SIGNAL(diameterChanged(int)),this,SIGNAL(currentPenSizeChanged(int)));


    // Creation du selecteur de diametre des PNJ
    m_npcDiameter = new DiameterSelector(m_mainWidget, false, 12, 200);
    m_npcDiameter->setToolTip(tr("NPC Size"));
	connect(m_npcDiameter,SIGNAL(diameterChanged(int)),this,SIGNAL(currentNpcSizeChanged(int)));

	//Creation du separateur se trouvant entre le selecteur de couleur et les outils de dessin
    QFrame *separateur1 = new QFrame(m_mainWidget);
	separateur1->setFrameStyle(QFrame::HLine | QFrame::Sunken);
	separateur1->setMinimumHeight(15);
	separateur1->setLineWidth(1);
	separateur1->setMidLineWidth(0);
	
	// Creation du separateur se trouvant entre les outils de dessin et le selecteur de diametre du trait
    QWidget *separateur2 = new QWidget(m_mainWidget);
	separateur2->setFixedHeight(3);
	
	//Creation du separateur se trouvant entre les outils de dessin et ceux de deplacement des PNJ
    QFrame *separateur3 = new QFrame(m_mainWidget);
	separateur3->setFrameStyle(QFrame::HLine | QFrame::Sunken);
	separateur3->setMinimumHeight(10);
	separateur3->setLineWidth(1);
	separateur3->setMidLineWidth(0);

	//Creation du separateur se trouvant entre les outils de deplacement et ceux d'ajout des PNJ
    QFrame *separateur4 = new QFrame(m_mainWidget);
	separateur4->setFrameStyle(QFrame::HLine | QFrame::Sunken);
	separateur4->setMinimumHeight(10);
	separateur4->setLineWidth(1);
	separateur4->setMidLineWidth(0);

	// Creation du separateur se trouvant au dessus du selecteur de diametre des PNJ
    QWidget *separateur5 = new QWidget(m_mainWidget);
	separateur5->setFixedHeight(3);
	
	// Ajout des differents layouts et widgets dans outilsLayout
    outilsLayout->addWidget(m_color);
	outilsLayout->addWidget(separateur1);
	outilsLayout->addLayout(layoutDessin);

	outilsLayout->addWidget(m_textEdit);
	outilsLayout->addWidget(separateur2);
	outilsLayout->addWidget(m_lineDiameter);
	outilsLayout->addWidget(separateur3);
	outilsLayout->addLayout(layoutMouvementPnj);
	outilsLayout->addWidget(separateur4);
	outilsLayout->addLayout(layoutAjoutPnj);

	outilsLayout->addWidget(m_npcNameEdit);
	outilsLayout->addWidget(separateur5);
        //if(PlayersList::instance().localPlayer()->isGM())
    outilsLayout->addWidget(m_npcDiameter);
        //outilsLayout->addWidget(m_pcDiameter);
	// Alignement du widget outils sur le haut du dockWidget
    layout()->setAlignment(m_mainWidget, Qt::AlignTop | Qt::AlignHCenter);
	// Contraintes de taille sur la barre d'outils
    m_mainWidget->setFixedWidth((DEFAULT_ICON_SIZE+8)*layoutDessin->columnCount());
	setMaximumWidth((DEFAULT_ICON_SIZE+8)*layoutDessin->columnCount()+10);
}
コード例 #14
0
ファイル: raindroptool.cpp プロジェクト: UIKit0/digikam
RainDropTool::RainDropTool(QObject* parent)
    : EditorToolThreaded(parent),
      d(new RainDropToolPriv)
{
    setObjectName("raindrops");
    setToolName(i18n("Raindrops"));
    setToolIcon(SmallIcon("raindrop"));

    d->previewWidget = new ImageGuideWidget(0, false, ImageGuideWidget::HVGuideMode);
    d->previewWidget->setWhatsThis(i18n("This is the preview of the Raindrop effect."
                                        "<p>Note: if you have previously selected an area in the editor, "
                                        "this will be unaffected by the filter. You can use this method to "
                                        "disable the Raindrops effect on a human face, for example.</p>"));

    setToolView(d->previewWidget);
    setPreviewModeMask(PreviewToolBar::AllPreviewModes);

    // -------------------------------------------------------------

    d->gboxSettings = new EditorToolSettings;
    d->gboxSettings->setButtons(EditorToolSettings::Default|
                                EditorToolSettings::Ok|
                                EditorToolSettings::Try|
                                EditorToolSettings::Cancel);


    // -------------------------------------------------------------

    QLabel* label1 = new QLabel(i18n("Drop size:"));
    d->dropInput   = new RIntNumInput;
    d->dropInput->setRange(0, 200, 1);
    d->dropInput->setSliderEnabled(true);
    d->dropInput->setDefaultValue(80);
    d->dropInput->setWhatsThis( i18n("Set here the raindrops' size."));

    // -------------------------------------------------------------

    QLabel* label2 = new QLabel(i18n("Number:"));
    d->amountInput = new RIntNumInput;
    d->amountInput->setRange(1, 500, 1);
    d->amountInput->setSliderEnabled(true);
    d->amountInput->setDefaultValue(150);
    d->amountInput->setWhatsThis( i18n("This value controls the maximum number of raindrops."));

    // -------------------------------------------------------------

    QLabel* label3 = new QLabel(i18n("Fish eyes:"));
    d->coeffInput  = new RIntNumInput;
    d->coeffInput->setRange(1, 100, 1);
    d->coeffInput->setSliderEnabled(true);
    d->coeffInput->setDefaultValue(30);
    d->coeffInput->setWhatsThis( i18n("This value is the fish-eye-effect optical "
                                      "distortion coefficient."));

    // -------------------------------------------------------------

    QGridLayout* mainLayout = new QGridLayout;
    mainLayout->addWidget(label1,         0, 0, 1, 3);
    mainLayout->addWidget(d->dropInput,   1, 0, 1, 3);
    mainLayout->addWidget(label2,         2, 0, 1, 3);
    mainLayout->addWidget(d->amountInput, 3, 0, 1, 3);
    mainLayout->addWidget(label3,         4, 0, 1, 3);
    mainLayout->addWidget(d->coeffInput,  5, 0, 1, 3);
    mainLayout->setRowStretch(6, 10);
    mainLayout->setMargin(d->gboxSettings->spacingHint());
    mainLayout->setSpacing(d->gboxSettings->spacingHint());
    d->gboxSettings->plainPage()->setLayout(mainLayout);

    // -------------------------------------------------------------

    setToolSettings(d->gboxSettings);
    init();
}
コード例 #15
0
void KoUniColorChooser::doComplexLayout()
{
    QGridLayout *mGrid = new QGridLayout;
    QGridLayout *mGrowGrid = new QGridLayout;

    mGrid->setSpacing(1);
    mGrid->setMargin(0);

    mGrid->addWidget(m_xycolorselector, 0, 0, -1, 1, Qt::AlignTop);

    mGrid->addWidget(m_colorpatch, 0, 1, 1, 4, Qt::AlignCenter);

    mGrid->addWidget(m_colorSlider, 1, 1, -1, 1, Qt::AlignTop);

    mGrid->addWidget(m_HRB, 1, 2, Qt::AlignCenter);
    mGrid->addWidget(m_SRB, 2, 2, Qt::AlignCenter);
    mGrid->addWidget(m_VRB, 3, 2, Qt::AlignCenter);

    mGrid->addWidget(m_RRB, 5, 2, Qt::AlignCenter);
    mGrid->addWidget(m_GRB, 6, 2, Qt::AlignCenter);
    mGrid->addWidget(m_BRB, 7, 2, Qt::AlignCenter);

    mGrid->addWidget(m_LRB, 5, 6, Qt::AlignCenter);
    mGrid->addWidget(m_aRB, 6, 6, Qt::AlignCenter);
    mGrid->addWidget(m_bRB, 7, 6, Qt::AlignCenter);

    mGrid->addWidget(m_HLabel, 1, 3, Qt::AlignTop);
    mGrid->addWidget(m_SLabel, 2, 3, Qt::AlignTop);
    mGrid->addWidget(m_VLabel, 3, 3, Qt::AlignTop);

    mGrid->addWidget(m_RLabel, 5, 3, Qt::AlignTop);
    mGrid->addWidget(m_GLabel, 6, 3, Qt::AlignTop);
    mGrid->addWidget(m_BLabel, 7, 3, Qt::AlignTop);

    if ( cmykColorSpace() ) {
        mGrid->addWidget(m_CLabel, 0, 7, Qt::AlignTop);
        mGrid->addWidget(m_MLabel, 1, 7, Qt::AlignTop);
        mGrid->addWidget(m_YLabel, 2, 7, Qt::AlignTop);
        mGrid->addWidget(m_KLabel, 3, 7, Qt::AlignTop);

    }

    mGrid->addWidget(m_LLabel, 5, 7, Qt::AlignTop);
    mGrid->addWidget(m_aLabel, 6, 7, Qt::AlignTop);
    mGrid->addWidget(m_bLabel, 7, 7, Qt::AlignTop);

    mGrid->addWidget(m_HIn, 1, 4, Qt::AlignTop);
    mGrid->addWidget(m_SIn, 2, 4, Qt::AlignTop);
    mGrid->addWidget(m_VIn, 3, 4, Qt::AlignTop);

    mGrid->addWidget(m_RIn, 5, 4, Qt::AlignTop);
    mGrid->addWidget(m_GIn, 6, 4, Qt::AlignTop);
    mGrid->addWidget(m_BIn, 7, 4, Qt::AlignTop);

    if ( cmykColorSpace() ) {
        mGrid->addWidget(m_CIn, 0, 8, Qt::AlignTop);
        mGrid->addWidget(m_MIn, 1, 8, Qt::AlignTop);
        mGrid->addWidget(m_YIn, 2, 8, Qt::AlignTop);
        mGrid->addWidget(m_KIn, 3, 8, Qt::AlignTop);
    }

    mGrid->addWidget(m_LIn, 5, 8, Qt::AlignTop);
    mGrid->addWidget(m_aIn, 6, 8, Qt::AlignTop);
    mGrid->addWidget(m_bIn, 7, 8, Qt::AlignTop);

    if(m_showOpacitySlider)
    {
        mGrid->addItem( new QSpacerItem( 4, 4, QSizePolicy::Fixed, QSizePolicy::Fixed), 8, 5 );

        mGrid->addWidget(m_opacityLabel, 9, 0, Qt::AlignRight | Qt::AlignTop);
        mGrid->addWidget(m_opacitySlider, 9, 1, 1, 7, Qt::AlignTop);
        mGrid->addWidget(m_opacityIn, 9, 8, Qt::AlignTop);
    }

    mGrid->addItem( new QSpacerItem( 4, 4, QSizePolicy::Fixed, QSizePolicy::Fixed), 4, 5 );

    mGrowGrid->addLayout(mGrid, 0, 0);
    mGrowGrid->setSpacing(0);
    mGrowGrid->setMargin(0);
    mGrowGrid->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding ), 1, 1 );

    setLayout(mGrowGrid);
}
コード例 #16
0
FeatureClassWidget::FeatureClassWidget(QWidget* pParent) :
   ModifierWidget(pParent),
   mpEditFeatureClass(NULL),
   mpFeatureClass(NULL),
   mbDisplayOnlyChanges(true)
{
   QTabWidget* pTabWidget = new QTabWidget(this);

   QWidget* pConnectionTab = new QWidget(this);
   QGridLayout* pConnectionLayout = new QGridLayout(pConnectionTab);
   QLabel* pLayerNameLabel = new QLabel("Layer name:", pConnectionTab);
   mpLayerNameEdit = new QLineEdit(pConnectionTab);
   mpConnection = new ConnectionParametersWidget(pConnectionTab);

   pConnectionLayout->addWidget(pLayerNameLabel, 0, 0);
   pConnectionLayout->addWidget(mpLayerNameEdit, 0, 1);
   pConnectionLayout->addWidget(mpConnection, 1, 0, 1, 2);

   QueryOptionsWidget* pInspector = new QueryOptionsWidget(this);
   mpDisplay = new ListInspectorWidget(pInspector, this);

   mpClipping = new QWidget(this);
   mpNoClipButton = new QRadioButton("No clip", mpClipping);
   mpSceneClipButton = new QRadioButton("Clip to scene", mpClipping);
   mpSpecifiedClipButton = new QRadioButton("Specified clip", mpClipping);
   mpNorthEdit = new LatLonLineEdit(mpClipping);
   mpSouthEdit = new LatLonLineEdit(mpClipping);
   mpEastEdit = new LatLonLineEdit(mpClipping);
   mpWestEdit = new LatLonLineEdit(mpClipping);
   QLabel* pNorthLabel = new QLabel("North:", mpClipping);
   QLabel* pSouthLabel = new QLabel("South:", mpClipping);
   QLabel* pEastLabel = new QLabel("East:", mpClipping);
   QLabel* pWestLabel = new QLabel("West:", mpClipping);

   mSpecifiedClipWidgets.push_back(mpNorthEdit);
   mSpecifiedClipWidgets.push_back(mpSouthEdit);
   mSpecifiedClipWidgets.push_back(mpEastEdit);
   mSpecifiedClipWidgets.push_back(mpWestEdit);
   mSpecifiedClipWidgets.push_back(pNorthLabel);
   mSpecifiedClipWidgets.push_back(pSouthLabel);
   mSpecifiedClipWidgets.push_back(pEastLabel);
   mSpecifiedClipWidgets.push_back(pWestLabel);

   QGridLayout* pClipLayout = new QGridLayout(mpClipping);
   pClipLayout->setColumnStretch(2, 10);
   pClipLayout->setColumnMinimumWidth(0, 15);
   pClipLayout->addWidget(mpNoClipButton, 0, 0, 1, 3);
   pClipLayout->addWidget(mpSceneClipButton, 1, 0, 1, 3);
   pClipLayout->addWidget(mpSpecifiedClipButton, 2, 0, 1, 3);
   pClipLayout->addWidget(pNorthLabel, 3, 1);
   pClipLayout->addWidget(mpNorthEdit, 3, 2);
   pClipLayout->addWidget(pSouthLabel, 4, 1);
   pClipLayout->addWidget(mpSouthEdit, 4, 2);
   pClipLayout->addWidget(pEastLabel, 5, 1);
   pClipLayout->addWidget(mpEastEdit, 5, 2);
   pClipLayout->addWidget(pWestLabel, 6, 1);
   pClipLayout->addWidget(mpWestEdit, 6, 2);
   pClipLayout->setRowStretch(7, 10);

   pTabWidget->addTab(pConnectionTab, "Connection");
   pTabWidget->addTab(mpDisplay, "Display");
   pTabWidget->addTab(mpClipping, "Clipping");

   mpErrorLabel = new QLabel(this);
   // Font
   QFont errorFont = mpErrorLabel->font();
   errorFont.setBold(true);
   mpErrorLabel->setFont(errorFont);

   // Text color
   QPalette errorPalette = mpErrorLabel->palette();
   errorPalette.setColor(QPalette::WindowText, Qt::red);
   mpErrorLabel->setPalette(errorPalette);

   // Word wrap
   mpErrorLabel->setWordWrap(true);

   QPushButton* pTestConnectionButton = new QPushButton("Test Connection", this);

   mpProgressBar = new QProgressBar(this);
   mpProgressBar->setRange(0, 0);
   mpProgressBar->setHidden(true);
   
   QGridLayout* pLayout = new QGridLayout(this);
   pLayout->setMargin(0);
   pLayout->setSpacing(5);
   pLayout->setColumnStretch(1, 10);

   pLayout->addWidget(pTabWidget, 0, 0, 1, 3);
   pLayout->addWidget(mpProgressBar, 1, 0);
   pLayout->addWidget(mpErrorLabel, 1, 1);
   pLayout->addWidget(pTestConnectionButton, 1, 2);

   // Initialization
   setWindowTitle("Shape File");

   // Connections
   VERIFYNR(connect(pTabWidget, SIGNAL(currentChanged(int)), this, SLOT(testConnection())));
   VERIFYNR(connect(pTestConnectionButton, SIGNAL(clicked()), this, SLOT(testConnection())));

   VERIFYNR(connect(mpConnection, SIGNAL(modified()), this, SLOT(updateConnectionParameters())));
   VERIFYNR(attachSignal(mpConnection, SIGNAL(modified())));

   VERIFYNR(connect(mpDisplay, SIGNAL(addItems()), this, SLOT(addDisplayItems())));
   VERIFYNR(connect(mpDisplay, SIGNAL(saveInspector(QWidget*, QListWidgetItem*)),
      this, SLOT(saveDisplayInspector(QWidget*, QListWidgetItem*))));
   VERIFYNR(connect(mpDisplay, SIGNAL(loadInspector(QWidget*, QListWidgetItem*)),
      this, SLOT(loadDisplayInspector(QWidget*, QListWidgetItem*))));
   VERIFYNR(connect(mpDisplay, SIGNAL(removeItem(QListWidgetItem*)),
      this, SLOT(removeDisplayItem(QListWidgetItem*))));

   VERIFYNR(connect(mpNoClipButton, SIGNAL(toggled(bool)), this, SLOT(clipButtonClicked())));
   VERIFYNR(connect(mpSceneClipButton, SIGNAL(toggled(bool)), this, SLOT(clipButtonClicked())));
   VERIFYNR(connect(mpSpecifiedClipButton, SIGNAL(toggled(bool)), this, SLOT(clipButtonClicked())));
}
コード例 #17
0
void KoUniColorChooser::doSimpleLayout()
{
    m_HRB->setVisible( false );
    m_SRB->setVisible( false );
    m_VRB->setVisible( false );

    m_RRB->setVisible( false );
    m_GRB->setVisible( false );
    m_BRB->setVisible( false );

    m_LRB->setVisible( false );
    m_aRB->setVisible( false );
    m_bRB->setVisible( false );

    m_HLabel->setVisible( false );
    m_SLabel->setVisible( false );
    m_VLabel->setVisible( false );

    m_RLabel->setVisible( false );
    m_GLabel->setVisible( false );
    m_BLabel->setVisible( false );

    if ( cmykColorSpace() ) {
        m_CLabel->setVisible( false );
        m_MLabel->setVisible( false );
        m_YLabel->setVisible( false );
        m_KLabel->setVisible( false );

    }

    m_LLabel->setVisible( false );
    m_aLabel->setVisible( false );
    m_bLabel->setVisible( false );

    m_HIn->setVisible( false );
    m_SIn->setVisible( false );
    m_VIn->setVisible( false );

    m_RIn->setVisible( false );
    m_GIn->setVisible( false );
    m_BIn->setVisible( false );

    if ( cmykColorSpace() ) {
        m_CIn->setVisible( false );
        m_MIn->setVisible( false );
        m_YIn->setVisible( false );
        m_KIn->setVisible( false );
    }

    m_LIn->setVisible( false );
    m_aIn->setVisible( false );
    m_bIn->setVisible( false );

    if(m_showOpacitySlider)
    {
        m_opacityLabel->setVisible( false );
        m_opacityIn->setVisible( false );
    }

    QGridLayout * layout = new QGridLayout;

    layout->setSpacing( 5 );

    if( m_showOpacitySlider )
    {
        m_opacitySlider->setFixedSize( 137, 25 );
        m_opacitySlider->setToolTip( i18n( "Opacity" ) );
        m_colorSlider->setFixedSize( 25, 137 );

        layout->addWidget(m_xycolorselector, 0, 0, 1, 1 );
        layout->addWidget(m_colorSlider, 0, 1, 1, 1 );
        layout->addWidget(m_colorpatch, 1, 1, 1, 1, Qt::AlignLeft|Qt::AlignTop);
        layout->addWidget(m_opacitySlider, 1, 0, 1, 1);
    }
    else
    {
        m_colorSlider->setFixedSize( 25, 115 );
        layout->addWidget(m_xycolorselector, 0, 0, 2, 1 );
        layout->addWidget(m_colorSlider, 0, 1, 1, 1 );
        layout->addWidget(m_colorpatch, 1, 1, 1, 1, Qt::AlignLeft|Qt::AlignTop);
    }

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

    setLayout( layout );
}
コード例 #18
0
AccountWidget::AccountWidget( QWidget* parent )
    : QWidget( parent )
    , TomahawkUtils::DpiScaler( this )
{
    QHBoxLayout *mainLayout = new QHBoxLayout( this );
    TomahawkUtils::unmarginLayout( mainLayout );
    setLayout( mainLayout );
    setContentsMargins( 0, scaledY( 8 ), 0, scaledY( 8 ) );

    m_imageLabel = new QLabel( this );
    mainLayout->addWidget( m_imageLabel );
    mainLayout->setSpacing( scaledX( 4 ) );

    QGridLayout* vLayout = new QGridLayout( this );
    vLayout->setSpacing( 8 );
    mainLayout->addLayout( vLayout );

    QFrame* idContainer = new QFrame( this );
    idContainer->setAttribute( Qt::WA_TranslucentBackground, false );
    vLayout->addWidget( idContainer, 0, 0 );

    QHBoxLayout* idContLayout = new QHBoxLayout( idContainer );
    idContainer->setLayout( idContLayout );
    idContainer->setContentsMargins( 0, 0, 0, 0 );
    idContLayout->setMargin( 2 );

    m_idLabel = new ElidedLabel( idContainer );
    m_idLabel->setElideMode( Qt::ElideRight );
    m_idLabel->setContentsMargins( 3, 0, 3, 0 );
    m_idLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
    m_idLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
    idContLayout->addWidget( m_idLabel );

    m_spinnerWidget = new QWidget( idContainer );
    QSize spinnerSize = 16 > TomahawkUtils::defaultFontHeight()  ?
                            QSize( 16, 16 ) :
                            QSize( TomahawkUtils::defaultFontHeight(),
                                   TomahawkUtils::defaultFontHeight() );
    m_spinnerWidget->setFixedSize( spinnerSize );
    idContLayout->addWidget( m_spinnerWidget );
    m_spinnerWidget->setContentsMargins( 0, 1, 0, 0 );
    m_spinner = new AnimatedSpinner( m_spinnerWidget->size() - QSize( 2, 2 ), m_spinnerWidget );

    idContainer->setStyleSheet( QString( "QFrame {"
                                "border: 1px solid #e9e9e9;"
                                "border-radius: %1px;"
                                "background: #e9e9e9;"
                                "}" ).arg( idContainer->sizeHint().height() / 2 + 1 ) );
    idContainer->setMinimumHeight( spinnerSize.height() + 6 /*margins*/ );

    m_statusToggle = new SlideSwitchButton( this );
    m_statusToggle->setContentsMargins( 0, 0, 0, 0 );
    m_statusToggle->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding );
    m_statusToggle->setFixedSize( m_statusToggle->sizeHint() );
    QHBoxLayout *statusToggleLayout = new QHBoxLayout( this );
    vLayout->addLayout( statusToggleLayout, 0, 1, 1, 1 );
    statusToggleLayout->addStretch();
    statusToggleLayout->addWidget( m_statusToggle );

    m_inviteContainer = new UnstyledFrame( this );
    vLayout->addWidget( m_inviteContainer, 1, 0 );
    m_inviteContainer->setFrameColor( TomahawkStyle::BORDER_LINE );
    m_inviteContainer->setMinimumWidth( m_inviteContainer->logicalDpiX() * 2 );
    m_inviteContainer->setContentsMargins( 1, 1, 1, 2 );
    m_inviteContainer->setAttribute( Qt::WA_TranslucentBackground, false );
    m_inviteContainer->setStyleSheet( "background: white" );

    QHBoxLayout* containerLayout = new QHBoxLayout( m_inviteContainer );
    m_inviteContainer->setLayout( containerLayout );
    TomahawkUtils::unmarginLayout( containerLayout );
    containerLayout->setContentsMargins( 1, 1, 0, 0 );

    m_addAccountIcon = new QLabel( m_inviteContainer );
    m_addAccountIcon->setContentsMargins( 1, 0, 0, 0 );
    m_addAccountIcon->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::AddContact, TomahawkUtils::Original, QSize( 16, 16 ) ) );
    m_addAccountIcon->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding );
    m_addAccountIcon->setAlignment( Qt::AlignCenter );
    containerLayout->addWidget( m_addAccountIcon );

    m_inviteEdit = new QLineEdit( m_inviteContainer );
    m_inviteEdit->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
    containerLayout->addWidget( m_inviteEdit );
    m_inviteEdit->setFrame( false );

    m_inviteButton = new QPushButton( this );
    m_inviteButton->setMinimumWidth( m_inviteButton->logicalDpiX() * 0.8 );
    m_inviteButton->setText( tr( "Invite" ) );
    m_inviteButton->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Preferred );
    vLayout->addWidget( m_inviteButton, 1, 1 );
    vLayout->setColumnStretch( 0, 1 );

#ifdef Q_OS_MAC
    layout()->setContentsMargins( 0, 0, 0, 0 );
#endif

    setInviteWidgetsEnabled( false );
}
コード例 #19
0
OptionsRasterElementImporter::OptionsRasterElementImporter() :
   QWidget(NULL),
   mpAutoGeorefGroup(NULL),
   mpImporterPlugInRadio(NULL),
   mpPlugInList(NULL),
   mpLatLonLayerCheck(NULL)
{
   // Georeference
   mpAutoGeorefGroup = new QGroupBox("Automatically georeference on import", this);
   mpAutoGeorefGroup->setCheckable(true);

   mpImporterPlugInRadio = new QRadioButton("Use plug-in determined by the importer", mpAutoGeorefGroup);
   QRadioButton* pPlugInRadio = new QRadioButton("Use best available plug-in:", mpAutoGeorefGroup);
   mpPlugInList = new MutuallyExclusiveListWidget(mpAutoGeorefGroup);

   mpLatLonLayerCheck = new QCheckBox("Display latitude/longitude layer", mpAutoGeorefGroup);

   LabeledSection* pGeoreferenceSection = new LabeledSection(mpAutoGeorefGroup, "Georeference", this);

   // Layout
   QGridLayout* pAutoGeorefGrid = new QGridLayout(mpAutoGeorefGroup);
   pAutoGeorefGrid->setMargin(10);
   pAutoGeorefGrid->setSpacing(10);
   pAutoGeorefGrid->addWidget(mpImporterPlugInRadio, 0, 0, 1, 2);
   pAutoGeorefGrid->addWidget(pPlugInRadio, 1, 0, 1, 2);
   pAutoGeorefGrid->addWidget(mpPlugInList, 2, 1);
   pAutoGeorefGrid->addWidget(mpLatLonLayerCheck, 3, 0, 1, 2);
   pAutoGeorefGrid->setColumnMinimumWidth(0, 12);
   pAutoGeorefGrid->setRowStretch(2, 10);
   pAutoGeorefGrid->setColumnStretch(1, 10);

   QVBoxLayout* pLayout = new QVBoxLayout(this);
   pLayout->setMargin(0);
   pLayout->setSpacing(10);
   pLayout->addWidget(pGeoreferenceSection, 10);

   // Initialization
   mpAutoGeorefGroup->setChecked(RasterElementImporterShell::getSettingAutoGeoreference());
   mpImporterPlugInRadio->setChecked(RasterElementImporterShell::getSettingImporterGeoreferencePlugIn());
   pPlugInRadio->setChecked(!RasterElementImporterShell::getSettingImporterGeoreferencePlugIn());
   mpPlugInList->setDisabled(RasterElementImporterShell::getSettingImporterGeoreferencePlugIn());
   mpLatLonLayerCheck->setChecked(RasterElementImporterShell::getSettingDisplayLatLonLayer());

   Service<PlugInManagerServices> pManager;
   QStringList plugInNames;

   std::vector<PlugInDescriptor*> descriptors = pManager->getPlugInDescriptors("Georeference");
   for (std::vector<PlugInDescriptor*>::const_iterator iter = descriptors.begin(); iter != descriptors.end(); ++iter)
   {
      PlugInDescriptor* pDescriptor = *iter;
      if (pDescriptor != NULL)
      {
         const std::string& plugInName = pDescriptor->getName();
         if (plugInName.empty() == false)
         {
            plugInNames.append(QString::fromStdString(plugInName));
         }
      }
   }

   QStringList selectedPlugInNames;

   std::vector<std::string> geoPlugIns = RasterElementImporterShell::getSettingGeoreferencePlugIns();
   for (std::vector<std::string>::const_iterator iter = geoPlugIns.begin(); iter != geoPlugIns.end(); ++iter)
   {
      std::string plugInName = *iter;
      if (plugInName.empty() == false)
      {
         selectedPlugInNames.append(QString::fromStdString(plugInName));
      }
   }

   mpPlugInList->setAvailableItemsLabel("Available Plug-Ins:");
   mpPlugInList->setAvailableItems(plugInNames);
   mpPlugInList->setSelectedItemsLabel("Preferred Plug-Ins:");
   mpPlugInList->selectItems(selectedPlugInNames);

   // Connections
   VERIFYNR(connect(pPlugInRadio, SIGNAL(toggled(bool)), mpPlugInList, SLOT(setEnabled(bool))));
}
コード例 #20
0
ファイル: SearchDialog.cpp プロジェクト: KDE/kphotoalbum
Exif::SearchDialog::SearchDialog( QWidget* parent )
    : KPageDialog( parent )
{
    setWindowTitle( i18n("EXIF Search") );
    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::Help);
    QWidget *mainWidget = new QWidget(this);
    QVBoxLayout *mainLayout = new QVBoxLayout;
    setLayout(mainLayout);
    mainLayout->addWidget(mainWidget);
    QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
    okButton->setDefault(true);
    okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
    //PORTING SCRIPT: WARNING mainLayout->addWidget(buttonBox) must be last item in layout. Please move it.
    mainLayout->addWidget(buttonBox);
    setFaceType( Tabbed );

    QWidget* settings = new QWidget;
    KPageWidgetItem* page = new KPageWidgetItem( settings, i18n("Settings" ) );

    addPage(  page );
    QVBoxLayout* vlay = new QVBoxLayout( settings );

    // Iso, Exposure, Aperture, FNumber
    QHBoxLayout* hlay = new QHBoxLayout;
    vlay->addLayout( hlay );
    QGridLayout* gridLayout = new QGridLayout;
    gridLayout->setSpacing( 6 );
    hlay->addLayout( gridLayout );
    hlay->addStretch( 1 );

    makeISO( gridLayout );
    makeExposureTime( gridLayout );
    hlay->addSpacing(30);

    gridLayout = new QGridLayout;
    gridLayout->setSpacing( 6 );
    hlay->addLayout( gridLayout );
    hlay->addStretch( 1 );
    m_apertureValue = makeApertureOrFNumber( i18n( "Aperture Value" ), QString::fromLatin1( "Exif_Photo_ApertureValue" ), gridLayout, 0 );
    m_fNumber = makeApertureOrFNumber( i18n( "F Number" ), QString::fromLatin1( "Exif_Photo_FNumber" ), gridLayout, 1 );

    hlay->addSpacing(30);

    // Focal length
    QHBoxLayout* focalLayout = new QHBoxLayout;
    focalLayout->setSpacing( 6 );
    hlay->addLayout( focalLayout );
    hlay->addStretch( 1 );

    QLabel* label = new QLabel( i18n( "Focal Length" ) );
    focalLayout->addWidget(label);

    m_fromFocalLength = new QSpinBox;
    focalLayout->addWidget(m_fromFocalLength);
    m_fromFocalLength->setRange( 0, 10000 );
    m_fromFocalLength->setSingleStep( 10 );

    label = new QLabel( i18nc("As in 'A range from x to y'","to"));
    focalLayout->addWidget(label);

    m_toFocalLength = new QSpinBox;
    focalLayout->addWidget(m_toFocalLength);
    m_toFocalLength->setRange( 0, 10000 );
    m_toFocalLength->setSingleStep( 10 );

    m_toFocalLength->setValue( 10000 );
    QString suffix = i18nc( "This is millimeter for focal length, like 35mm", "mm" );
    m_fromFocalLength->setSuffix( suffix );
    m_toFocalLength->setSuffix( suffix );

    connect( m_fromFocalLength, SIGNAL(valueChanged(int)), this, SLOT(fromFocalLengthChanged(int)) );
    connect( m_toFocalLength, SIGNAL(valueChanged(int)), this, SLOT(toFocalLengthChanged(int)) );

    // exposure program and Metring mode
    hlay = new QHBoxLayout;
    vlay->addLayout( hlay );
    hlay->addWidget( makeExposureProgram( settings ) );
    hlay->addWidget( makeMeteringMode( settings ) );

    vlay->addStretch( 1 );

    // ------------------------------------------------------------ Camera
    page = new KPageWidgetItem( makeCamera(), i18n("Camera") );
    addPage( page );

    // ------------------------------------------------------------ Lens
    page = new KPageWidgetItem( makeLens(), i18n("Lens") );
    addPage( page );

    // ------------------------------------------------------------ Misc
    QWidget* misc = new QWidget;
    addPage( new KPageWidgetItem( misc, i18n("Miscellaneous") ) );
    vlay = new QVBoxLayout( misc );
    vlay->addWidget( makeOrientation( misc ), 1 );

    hlay = new QHBoxLayout;
    vlay->addLayout( hlay );
    hlay->addWidget( makeContrast( misc ) );
    hlay->addWidget( makeSharpness( misc ) );
    hlay->addWidget( makeSaturation( misc ) );
    vlay->addStretch( 1 );
}
コード例 #21
0
ファイル: sequence_number.cpp プロジェクト: cwarden/quasar
SequenceNumber::SequenceNumber(MainWindow* main)
    : QuasarWindow(main, "SequenceNumber")
{
    _helpSource = "seq_number.html";

    QFrame* frame = new QFrame(this);
    QScrollView* sv = new QScrollView(frame);
    _nums = new QButtonGroup(4, Horizontal, tr("Seq Numbers"), sv->viewport());

    new QLabel("Type", _nums);
    new QLabel("Minimum", _nums);
    new QLabel("Maximum", _nums);
    new QLabel("Next", _nums);

    addIdEdit(tr("Data Object:"), "data_object", "object_id");
    addIdEdit(tr("Journal Entry:"), "gltx", "Journal Entry");
    addIdEdit(tr("Ledger Transfer:"), "gltx", "Ledger Transfer");
    addIdEdit(tr("Card Adjustment:"), "gltx", "Card Adjustment");
    addIdEdit(tr("Customer Invoice:"), "gltx", "Customer Invoice");
    addIdEdit(tr("Customer Return:"), "gltx", "Customer Return");
    addIdEdit(tr("Customer Payment:"), "gltx", "Customer Payment");
    addIdEdit(tr("Customer Quote:"), "quote", "number");
    addIdEdit(tr("Vendor Invoice:"), "gltx", "Vendor Invoice");
    addIdEdit(tr("Vendor Claim:"), "gltx", "Vendor Claim");
    addIdEdit(tr("Purchase Order:"), "porder", "number");
    addIdEdit(tr("Packing Slip:"), "slip", "number");
    addIdEdit(tr("Nosale:"), "gltx", "Nosale");
    addIdEdit(tr("Payout:"), "gltx", "Payout");
    addIdEdit(tr("Withdraw:"), "gltx", "Withdraw");
    addIdEdit(tr("Shift:"), "gltx", "Shift");
    addIdEdit(tr("Item Adjustment:"), "gltx", "Item Adjustment");
    addIdEdit(tr("Item Transfer:"), "gltx", "Item Transfer");
    addIdEdit(tr("Physical Count:"), "pcount", "number");
    addIdEdit(tr("Label Batch:"), "label_batch", "number");
    addIdEdit(tr("Price Batch:"), "price_batch", "number");
    addIdEdit(tr("Promo Batch:"), "promo_batch", "number");
    addIdEdit(tr("Company Number:"), "company", "number");
    addIdEdit(tr("Store Number:"), "store", "number");
    addIdEdit(tr("Station Number:"), "station", "number");
    addIdEdit(tr("Tender Count #:"), "tender_count", "number");
    addIdEdit(tr("Tender Menu #:"), "tender", "menu_num");

    QFrame* buttons = new QFrame(frame);
    QPushButton* ok = new QPushButton(tr("&OK"), buttons);
    QPushButton* quit = new QPushButton(tr("&Close"), buttons);

    connect(ok, SIGNAL(clicked()), SLOT(slotOk()));
    connect(quit, SIGNAL(clicked()), SLOT(close()));

    QGridLayout* buttonGrid = new QGridLayout(buttons);
    buttonGrid->setSpacing(3);
    buttonGrid->setMargin(3);
    buttonGrid->setColStretch(0, 1);
    buttonGrid->addWidget(ok, 0, 1);
    buttonGrid->addWidget(quit, 0, 2);

    _nums->resize(_nums->sizeHint());
    sv->setVScrollBarMode(QScrollView::AlwaysOn);
    sv->resizeContents(_nums->width() + 20, _nums->height());

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

    for (unsigned int i = 0; i < _ids.size(); ++i) {
	IdInfo& info = _ids[i];
	_quasar->db()->getSequence(info.seq);
	info.minNum->setFixed(info.seq.minNumber());
	info.maxNum->setFixed(info.seq.maxNumber());
	info.nextNum->setFixed(info.seq.nextNumber());
    }

    statusBar()->hide();
    setCentralWidget(frame);
    setCaption(tr("Sequence Numbers"));
    finalize();

    if (!allowed("View")) {
	QTimer::singleShot(50, this, SLOT(slotNotAllowed()));
	return;
    }
}
コード例 #22
0
ファイル: kdm-conv.cpp プロジェクト: aarontc/kde-workspace
KDMConvenienceWidget::KDMConvenienceWidget(QWidget *parent)
    : QWidget(parent)
{
    QString wtstr;

    QLabel *paranoia = new QLabel(
        i18n("<big><b><center>Attention<br/>"
             "Read help</center></b></big>"), this);
    QPalette p;
    p.setBrush(QPalette::WindowText,
        KColorScheme(QPalette::Active, KColorScheme::Window)
            .foreground(KColorScheme::NegativeText));
    paranoia->setPalette(p);

    QSizePolicy vpref(QSizePolicy::Minimum, QSizePolicy::Fixed);

    alGroup = new QGroupBox(i18n("Enable Au&to-Login"), this);
    alGroup->setCheckable(true);
    alGroup->setSizePolicy(vpref);
    QVBoxLayout *laygroup2 = new QVBoxLayout(alGroup);
    laygroup2->setSpacing(KDialog::spacingHint());

    alGroup->setWhatsThis(i18n("Turn on the auto-login feature."
                               " This applies only to KDM's graphical login."
                               " Think twice before enabling this!"));
    connect(alGroup, SIGNAL(toggled(bool)), SIGNAL(changed()));

    userlb = new KComboBox(alGroup);

    QLabel *u_label = new QLabel(i18n("Use&r:"), alGroup);
    u_label->setBuddy(userlb);
    QHBoxLayout *hlpl1 = new QHBoxLayout();
    laygroup2->addItem(hlpl1);
    hlpl1->setSpacing(KDialog::spacingHint());
    hlpl1->addWidget(u_label);
    hlpl1->addWidget(userlb);
    hlpl1->addStretch(1);
    connect(userlb, SIGNAL(highlighted(int)), SIGNAL(changed()));
    wtstr = i18n("Select the user to be logged in automatically.");
    u_label->setWhatsThis(wtstr);
    userlb->setWhatsThis(wtstr);
    autoLockCheck = new QCheckBox(i18n("Loc&k session"), alGroup);
    laygroup2->addWidget(autoLockCheck);
    connect(autoLockCheck, SIGNAL(toggled(bool)), SIGNAL(changed()));
    autoLockCheck->setWhatsThis(i18n(
        "The automatically started session "
        "will be locked immediately (provided it is a KDE session). This can "
        "be used to obtain a super-fast login restricted to one user."));

    puGroup = new QGroupBox(i18nc("@title:group", "Preselect User"), this);

    puGroup->setSizePolicy(vpref);

    npRadio = new QRadioButton(i18nc("@option:radio preselected user", "&None"), puGroup);
    ppRadio = new QRadioButton(i18nc("@option:radio preselected user", "Prev&ious"), puGroup);
    ppRadio->setWhatsThis(i18n(
        "Preselect the user that logged in previously. "
        "Use this if this computer is usually used several consecutive times by one user."));
    spRadio = new QRadioButton(i18nc("@option:radio preselected user", "Specifi&ed:"), puGroup);
    spRadio->setWhatsThis(i18n(
        "Preselect the user specified in the combo box to the right. "
        "Use this if this computer is predominantly used by a certain user."));
    QButtonGroup *buttonGroup = new QButtonGroup(puGroup);
    connect(buttonGroup, SIGNAL(buttonClicked(int)), SLOT(slotPresChanged()));
    connect(buttonGroup, SIGNAL(buttonClicked(int)), SIGNAL(changed()));
    buttonGroup->addButton(npRadio);
    buttonGroup->addButton(ppRadio);
    buttonGroup->addButton(spRadio);
    QVBoxLayout *laygroup5 = new QVBoxLayout(puGroup);
    laygroup5->setSpacing(KDialog::spacingHint());
    laygroup5->addWidget(npRadio);
    laygroup5->addWidget(ppRadio);

    puserlb = new KComboBox(true, puGroup);

    connect(puserlb, SIGNAL(editTextChanged(QString)), SIGNAL(changed()));
    wtstr = i18n(
        "Select the user to be preselected for login. "
        "This box is editable, so you can specify an arbitrary non-existent "
        "user to mislead possible attackers.");
    puserlb->setWhatsThis(wtstr);
    QBoxLayout *hlpl = new QHBoxLayout();
    laygroup5->addItem(hlpl);
    hlpl->setSpacing(KDialog::spacingHint());
    hlpl->setMargin(0);
    hlpl->addWidget(spRadio);
    hlpl->addWidget(puserlb);
    hlpl->addStretch(1);
    // This is needed before the abuse below to ensure the combo is enabled in time
    connect(spRadio, SIGNAL(clicked(bool)), SLOT(slotPresChanged()));
    // Abuse the radio button text as a label for the combo
    connect(spRadio, SIGNAL(clicked(bool)), puserlb, SLOT(setFocus()));
    cbjumppw = new QCheckBox(i18nc("@option:check action", "Focus pass&word"), puGroup);
    laygroup5->addWidget(cbjumppw);
    cbjumppw->setWhatsThis(i18n(
        "When this option is on, KDM will place the cursor "
        "in the password field instead of the user field after preselecting a user. "
        "Use this to save one key press per login, if the preselection usually "
        "does not need to be changed."));
    connect(cbjumppw, SIGNAL(toggled(bool)), SIGNAL(changed()));

    npGroup = new QGroupBox(i18n("Enable Password-&Less Logins"), this);
    QVBoxLayout *laygroup3 = new QVBoxLayout(npGroup);
    laygroup3->setSpacing(KDialog::spacingHint());

    npGroup->setCheckable(true);

    npGroup->setWhatsThis(i18n(
        "When this option is checked, the checked users from "
        "the list below will be allowed to log in without entering their "
        "password. This applies only to KDM's graphical login. "
        "Think twice before enabling this!"));

    connect(npGroup, SIGNAL(toggled(bool)), SIGNAL(changed()));

    QLabel *pl_label = new QLabel(i18n("No password re&quired for:"), npGroup);
    laygroup3->addWidget(pl_label);
    npuserlv = new QListWidget(npGroup);
    laygroup3->addWidget(npuserlv);
    pl_label->setBuddy(npuserlv);
    npuserlv->setWhatsThis(i18n(
        "Check all users you want to allow a password-less login for. "
        "Entries denoted with '@' are user groups. Checking a group is like "
        "checking all users in that group."));

    btGroup = new QGroupBox(i18nc("@title:group", "Miscellaneous"), this);
    QVBoxLayout *laygroup4 = new QVBoxLayout(btGroup);
    laygroup4->setSpacing(KDialog::spacingHint());

    cbarlen = new QCheckBox(i18n("Automatically log in again after &X server crash"), btGroup);
    cbarlen->setWhatsThis(i18n(
        "When this option is on, a user will be "
        "logged in again automatically when their session is interrupted by an "
        "X server crash; note that this can open a security hole: if you use "
        "a screen locker than KDE's integrated one, this will make "
        "circumventing a password-secured screen lock possible."));
    //TODO a screen locker _other_ than
    laygroup4->addWidget(cbarlen);
    connect(cbarlen, SIGNAL(toggled(bool)), SIGNAL(changed()));

    QGridLayout *main = new QGridLayout(this);
    main->setSpacing(10);
    main->addWidget(paranoia, 0, 0);
    main->addWidget(alGroup, 1, 0);
    main->addWidget(puGroup, 2, 0);
    main->addWidget(npGroup, 0, 1, 4, 1);
    main->addWidget(btGroup, 4, 0, 1, 2);
    main->setColumnStretch(0, 1);
    main->setColumnStretch(1, 2);
    main->setRowStretch(3, 1);

    connect(userlb, SIGNAL(activated(QString)),
            SLOT(slotSetAutoUser(QString)));
    connect(puserlb, SIGNAL(editTextChanged(QString)),
            SLOT(slotSetPreselUser(QString)));
    connect(npuserlv, SIGNAL(itemClicked(QListWidgetItem*)),
            SLOT(slotUpdateNoPassUser(QListWidgetItem*)));

}
コード例 #23
0
SubSurfaceInspectorView::SubSurfaceInspectorView(bool isIP, const openstudio::model::Model& model, QWidget * parent )
  : ModelObjectInspectorView(model, true, parent)
{
  m_isIP = isIP;

  QWidget* hiddenWidget = new QWidget();
  this->stackedWidget()->insertWidget(0, hiddenWidget);

  QWidget* visibleWidget = new QWidget();
  this->stackedWidget()->insertWidget(1, visibleWidget);

  this->stackedWidget()->setCurrentIndex(0);

  QGridLayout* mainGridLayout = new QGridLayout();
  mainGridLayout->setContentsMargins(7,7,7,7);
  mainGridLayout->setSpacing(14);
  visibleWidget->setLayout(mainGridLayout);

  // name
  QVBoxLayout* vLayout = new QVBoxLayout();

  QLabel* label = new QLabel();
  label->setText("Name: ");
  label->setStyleSheet("QLabel { font: bold; }");
  vLayout->addWidget(label);

  m_nameEdit = new OSLineEdit();
  vLayout->addWidget(m_nameEdit);

  mainGridLayout->addLayout(vLayout,0,0,1,2, Qt::AlignTop|Qt::AlignLeft);

  // subsurface type
  vLayout = new QVBoxLayout();

  label = new QLabel();
  label->setText("Sub Surface Type: ");
  label->setStyleSheet("QLabel { font: bold; }");
  vLayout->addWidget(label);

  m_subSurfaceType = new OSComboBox();
  vLayout->addWidget(m_subSurfaceType);

  vLayout->addStretch();

  mainGridLayout->addLayout(vLayout,1,0);

  // construction 
  vLayout = new QVBoxLayout();

  label = new QLabel();
  label->setText("Construction: ");
  label->setStyleSheet("QLabel { font: bold; }");
  vLayout->addWidget(label);

  m_constructionVectorController = new SubSurfaceConstructionVectorController();
  m_constructionDropZone = new OSDropZone(m_constructionVectorController);
  m_constructionDropZone->setMinItems(0);
  m_constructionDropZone->setMaxItems(1);
  m_constructionDropZone->setItemsAcceptDrops(true);
  vLayout->addWidget(m_constructionDropZone);

  vLayout->addStretch();

  mainGridLayout->addLayout(vLayout,1,1);

  // outside boundary condition object
  vLayout = new QVBoxLayout();

  label = new QLabel();
  label->setText("Outside Boundary Condition Object: ");
  label->setStyleSheet("QLabel { font: bold; }");
  vLayout->addWidget(label);

  m_outsideBoundaryConditionObjectVectorController = new SubSurfaceOutsideBoundaryConditionObjectVectorController();
  m_outsideBoundaryConditionObjectDropZone = new OSDropZone(m_outsideBoundaryConditionObjectVectorController);
  m_outsideBoundaryConditionObjectDropZone->setMinItems(0);
  m_outsideBoundaryConditionObjectDropZone->setMaxItems(1);
  m_outsideBoundaryConditionObjectDropZone->setItemsAcceptDrops(true);
  vLayout->addWidget(m_outsideBoundaryConditionObjectDropZone);

  vLayout->addStretch();

  mainGridLayout->addLayout(vLayout,2,0);

  // multiplier
  vLayout = new QVBoxLayout();

  label = new QLabel();
  label->setText("Multiplier: ");
  label->setStyleSheet("QLabel { font: bold; }");
  vLayout->addWidget(label);

  m_multiplier = new OSDoubleEdit();
  vLayout->addWidget(m_multiplier);

  vLayout->addStretch();

  mainGridLayout->addLayout(vLayout,3,0);

  // separator
  vLayout = new QVBoxLayout();

  QWidget * hLine = new QWidget();
  hLine->setObjectName("HLine");
  hLine->setStyleSheet("QWidget#HLine { background: #445051;}");
  hLine->setFixedHeight(2);
  vLayout->addWidget(hLine);

  label = new QLabel();
  label->setText("Vertices: ");
  label->setStyleSheet("QLabel { font: bold; }");
  vLayout->addWidget(label);

  mainGridLayout->addWidget(hLine,4,0,1,2);

  // planar surface widget
  m_planarSurfaceWidget = new PlanarSurfaceWidget(m_isIP);
  bool isConnected = connect(this, SIGNAL(toggleUnitsClicked(bool)), m_planarSurfaceWidget, SLOT(toggleUnits(bool)));
  OS_ASSERT(isConnected);

  mainGridLayout->addWidget(m_planarSurfaceWidget,5,0,1,2);

  mainGridLayout->setColumnMinimumWidth(0, 80);
  mainGridLayout->setColumnMinimumWidth(1, 80);
  mainGridLayout->setColumnStretch(2,1);
  mainGridLayout->setRowMinimumHeight(0, 30);
  mainGridLayout->setRowMinimumHeight(1, 30);
  mainGridLayout->setRowMinimumHeight(2, 30);
  mainGridLayout->setRowMinimumHeight(3, 30);
  mainGridLayout->setRowMinimumHeight(4, 30);
  mainGridLayout->setRowMinimumHeight(5, 30);
  mainGridLayout->setRowStretch(6,1);
}
コード例 #24
0
ファイル: cal2.cpp プロジェクト: AdachiQ/multiFunctionCal
cal2::cal2(QWidget *parent)
    : QWidget(parent)
{

    initBasicData();
//--------------------------顶层--------------------------------------------------------------
    QFont font1;
    font1.setPixelSize(15);

    QPalette palette1;
    palette1.setColor(QPalette::WindowText,QColor(155,155,155,255));

    today = new ClickedLabel;
    today->setFont(font1);
    today->setPalette(palette1);
    today->setText(tr("Today"));
    connect(today,SIGNAL(clicked(ClickedLabel*)),this,SLOT(todayOnClicked()));

    pre = new ClickedLabel;
    pre->setFont(font1);
    pre->setPalette(palette1);
    pre->setText(tr("PRE"));
    connect(pre,SIGNAL(clicked(ClickedLabel*)),this,SLOT(preOnClicked()));

    next = new ClickedLabel;
    next->setFont(font1);
    next->setPalette(palette1);
    next->setText(tr("NEXT"));
    connect(next,SIGNAL(clicked(ClickedLabel*)),this,SLOT(nextOnClicked()));

    month = new ClickedLabel;
    month->setFont(font1);
    month->setPalette(palette1);

    year = new ClickedLabel;
    year->setFont(font1);
    year->setPalette(palette1);

    QHBoxLayout *toplayout = new QHBoxLayout;
    toplayout->addWidget(today);
    toplayout->addStretch();
    toplayout->addWidget(pre);
    toplayout->addSpacing(20);
    toplayout->addWidget(month);
    toplayout->addSpacing(5);
    toplayout->addWidget(year);
    toplayout->addSpacing(20);
    toplayout->addWidget(next);
    toplayout->addStretch();

//--------------------------顶层结束----------------------------------------------------------



//---------------------------星期---------------------------------------------------------------
    QString weekstr[7]={"MON","TUE","WED","THU","FRI","SAT","SUN"};
    QHBoxLayout* weeklayout = new QHBoxLayout;
    weeklayout->setSpacing(0);

    QFont font2;
    font2.setPixelSize(15);
    QPalette palette2;
    palette2.setColor(QPalette::WindowText,QColor(155,155,155,255));

    for(int i=0;i<7;i++)
    {
        QLabel* label = new QLabel(tr("%1").arg(weekstr[i]));
        label->setFont(font2);
        label->setPalette(palette2);
        label->setAlignment(Qt::AlignBottom|Qt::AlignHCenter);
        label->setFixedHeight(20);
        weeklayout->addWidget(label);
    }


    QVBoxLayout *toplayout2 = new QVBoxLayout;
    toplayout2->addLayout(toplayout);
    toplayout2->addLayout(weeklayout);
    QWidget *topwidget = new QWidget;
    topwidget->setLayout(toplayout2);
    topwidget->setFixedHeight(70);
    topwidget->setAutoFillBackground(true);
    QPalette pet;
    pet.setColor(QPalette::Background,QColor(50,58,69));
    topwidget->setPalette(pet);
    topwidget->setFixedHeight(100);
    //topwidget->setStyleSheet("background-color: rgb(50,58,69)");

//---------------------------星期结束---------------------------------------------------------------



//----------------------------月历----------------------------------------------------------------
    QGridLayout* grid = new QGridLayout;
    grid->setSpacing(1);

    int row,col,num;
    for(row=0;row<6;row++)
        for(col=1;col<=7;col++)
        {
            num =row*7+col;
            labels[num] = new cal_label;

            QPalette lpa;
            lpa.setColor(QPalette::WindowText,QColor(200,200,200));
            labels[num]->lunarday->setPalette(lpa);
            connect(labels[num],SIGNAL(clicked(cal_label*)),this,SLOT(changeday(cal_label*)));
            grid->addWidget(labels[num],row,col-1);
        }

    QVBoxLayout* mainlayout = new QVBoxLayout();
    //mainlayout->setSpacing(0);
    mainlayout->addWidget(topwidget);
    mainlayout->addLayout(grid);


    QFont rtfont1;
    rtfont1.setPixelSize(30);
    righttop = new QLabel;
    righttop->setFont(rtfont1);
    righttop->setStyleSheet("color:white;background-color:rgb(20,185,214)");
    righttop->setFixedSize(360,100);
    //righttop->setAlignment(Qt::AlignCenter);
    righttop->setIndent(20);

    righttop2 = new QLabel;
    rtfont1.setPixelSize(20);
    righttop2->setFont(rtfont1);
    righttop2->setFixedHeight(100);
    righttop2->setStyleSheet("color:white;background-color:grey");
    righttop2->setAlignment(Qt::AlignCenter);
    //righttop2->setIndent(30);

    QVBoxLayout *rtlayout = new QVBoxLayout;
    rtlayout->addWidget(righttop);
    rtlayout->addWidget(righttop2);
    rtlayout->setSpacing(0);

//    QLabel *rtwidget = new QLabel;
//    rtwidget->setLayout(rtlayout);
//    rtwidget->setFixedHeight(200);
//    rtwidget->setStyleSheet("background-color:rgb(107,203,202)");
//    //rtwidget->setPalette(pet);

    todaylist = new QListWidget;
    QFont f1;
    f1.setPixelSize(20);
    todaylist->setFont(f1);
    //todaylist->setStyleSheet("background-color:rgb(24,34,144)");

    QVBoxLayout *right1 = new QVBoxLayout;
    right1->addLayout(rtlayout);
    right1->addWidget(todaylist);

    QHBoxLayout *lastlayout = new QHBoxLayout(this);
    lastlayout->setSpacing(1);
    lastlayout->addLayout(mainlayout);
    lastlayout->addLayout(right1);
    lastlayout->setMargin(0);

    newCal();

}
コード例 #25
0
LevelSettingsPopup::LevelSettingsPopup()
    : Dialog(TApp::instance()->getMainWindow(), false, false, "LevelSettings")
    , m_whiteTransp(0)
    , m_scanPathLabel(0)
    , m_scanPathFld(0) {
  setWindowTitle(tr("Level Settings"));

  m_nameFld       = new LineEdit();
  m_pathFld       = new FileField();  // Path
  m_scanPathLabel = new QLabel(tr("Scan Path:"));
  m_scanPathFld   = new FileField();  // ScanPath
  m_typeLabel     = new QLabel();     // Level Type
  // Type
  m_dpiTypeOm = new QComboBox();
  // DPI
  m_dpiLabel    = new QLabel(tr("DPI:"));
  m_dpiFld      = new DoubleLineEdit();
  m_squarePixCB = new CheckBox(tr("Forced Squared Pixel"));

  m_widthLabel  = new QLabel(tr("Width:"));
  m_widthFld    = new MeasuredDoubleLineEdit();
  m_heightLabel = new QLabel(tr("Height:"));
  m_heightFld   = new MeasuredDoubleLineEdit();
  // Use Camera Dpi
  m_useCameraDpiBtn = new QPushButton(tr("Use Camera DPI"));

  m_cameraDpiLabel = new QLabel(tr(""));
  m_imageDpiLabel  = new QLabel(tr(""));
  m_imageResLabel  = new QLabel(tr(""));
  m_cameraDpiTitle = new QLabel(tr("Camera DPI:"));
  m_imageDpiTitle  = new QLabel(tr("Image DPI:"));
  m_imageResTitle  = new QLabel(tr("Resolution:"));

  // subsampling
  m_subsamplingLabel = new QLabel(tr("Subsampling:"));
  m_subsamplingFld   = new DVGui::IntLineEdit(this, 1, 1);

  m_doPremultiply = new CheckBox(tr("Premultiply"), this);

  m_whiteTransp = new CheckBox(tr("White As Transparent"), this);

  m_doAntialias       = new CheckBox(tr("Add Antialiasing"), this);
  m_antialiasSoftness = new DVGui::IntLineEdit(0, 10, 0, 100);

  //----

  m_pathFld->setFileMode(QFileDialog::AnyFile);
  m_scanPathFld->setFileMode(QFileDialog::AnyFile);

  m_dpiTypeOm->addItem(tr("Image DPI"), "Image DPI");
  m_dpiTypeOm->addItem(tr("Custom DPI"), "Custom DPI");

  m_squarePixCB->setChecked(true);

  /*--- Levelサイズの単位はCameraUnitにする --*/
  m_widthFld->setMeasure("camera.lx");
  m_heightFld->setMeasure("camera.ly");

  if (Preferences::instance()->getCameraUnits() == "pixel") {
    m_widthFld->setDecimals(0);
    m_heightFld->setDecimals(0);
  }

  m_doPremultiply->setChecked(false);

  m_doAntialias->setChecked(false);
  m_antialiasSoftness->setEnabled(false);

  m_whiteTransp->setChecked(false);

  //----layout

  m_topLayout->setMargin(5);
  m_topLayout->setSpacing(5);
  {
    //--Name&Path
    QGroupBox *nameBox      = new QGroupBox(tr("Name && Path"), this);
    QGridLayout *nameLayout = new QGridLayout();
    nameLayout->setMargin(5);
    nameLayout->setSpacing(5);
    {
      nameLayout->addWidget(new QLabel(tr("Name:"), this), 0, 0,
                            Qt::AlignRight | Qt::AlignVCenter);
      nameLayout->addWidget(m_nameFld, 0, 1);
      nameLayout->addWidget(new QLabel(tr("Path:"), this), 1, 0,
                            Qt::AlignRight | Qt::AlignVCenter);
      nameLayout->addWidget(m_pathFld, 1, 1);
      nameLayout->addWidget(m_scanPathLabel, 2, 0,
                            Qt::AlignRight | Qt::AlignVCenter);
      nameLayout->addWidget(m_scanPathFld, 2, 1);
      nameLayout->addWidget(m_typeLabel, 3, 1);
    }
    nameLayout->setColumnStretch(0, 0);
    nameLayout->setColumnStretch(1, 1);
    nameBox->setLayout(nameLayout);

    m_topLayout->addWidget(nameBox);

    //----DPI & Resolution
    QGroupBox *dpiBox;
    if (Preferences::instance()->getUnits() == "pixel")
      dpiBox = new QGroupBox(tr("Resolution"), this);
    else
      dpiBox               = new QGroupBox(tr("DPI && Resolution"), this);
    QGridLayout *dpiLayout = new QGridLayout();
    dpiLayout->setMargin(5);
    dpiLayout->setSpacing(5);
    {
      dpiLayout->addWidget(m_dpiTypeOm, 0, 1, 1, 3);
      dpiLayout->addWidget(m_dpiLabel, 1, 0, Qt::AlignRight | Qt::AlignVCenter);
      dpiLayout->addWidget(m_dpiFld, 1, 1);
      dpiLayout->addWidget(m_squarePixCB, 1, 2, 1, 2,
                           Qt::AlignRight | Qt::AlignVCenter);
      dpiLayout->addWidget(m_widthLabel, 2, 0,
                           Qt::AlignRight | Qt::AlignVCenter);
      dpiLayout->addWidget(m_widthFld, 2, 1);
      dpiLayout->addWidget(m_heightLabel, 2, 2,
                           Qt::AlignRight | Qt::AlignVCenter);
      dpiLayout->addWidget(m_heightFld, 2, 3);
      dpiLayout->addWidget(m_useCameraDpiBtn, 3, 1, 1, 3);
      dpiLayout->addWidget(m_cameraDpiTitle, 4, 0,
                           Qt::AlignRight | Qt::AlignVCenter);
      dpiLayout->addWidget(m_cameraDpiLabel, 4, 1, 1, 3);
      dpiLayout->addWidget(m_imageDpiTitle, 5, 0,
                           Qt::AlignRight | Qt::AlignVCenter);
      dpiLayout->addWidget(m_imageDpiLabel, 5, 1, 1, 3);
      dpiLayout->addWidget(m_imageResTitle, 6, 0,
                           Qt::AlignRight | Qt::AlignVCenter);
      dpiLayout->addWidget(m_imageResLabel, 6, 1, 1, 3);
    }
    dpiLayout->setColumnStretch(0, 0);
    dpiLayout->setColumnStretch(1, 1);
    dpiLayout->setColumnStretch(2, 0);
    dpiLayout->setColumnStretch(3, 1);
    dpiBox->setLayout(dpiLayout);

    m_topLayout->addWidget(dpiBox);

    m_topLayout->addWidget(m_doPremultiply);

    m_topLayout->addWidget(m_whiteTransp);

    m_topLayout->addWidget(m_doAntialias);

    //---subsampling
    QGridLayout *bottomLay = new QGridLayout();
    bottomLay->setMargin(3);
    bottomLay->setSpacing(3);
    {
      bottomLay->addWidget(new QLabel(tr("Antialias Softness:"), this), 0, 0);
      bottomLay->addWidget(m_antialiasSoftness, 0, 1);

      bottomLay->addWidget(m_subsamplingLabel, 1, 0);
      bottomLay->addWidget(m_subsamplingFld, 1, 1);
    }
    bottomLay->setColumnStretch(0, 0);
    bottomLay->setColumnStretch(1, 0);
    bottomLay->setColumnStretch(2, 1);
    m_topLayout->addLayout(bottomLay);

    m_topLayout->addStretch();
  }

  //----signal/slot connections
  connect(m_nameFld, SIGNAL(editingFinished()), SLOT(onNameChanged()));
  connect(m_pathFld, SIGNAL(pathChanged()), SLOT(onPathChanged()));
  connect(m_dpiTypeOm, SIGNAL(currentIndexChanged(int)),
          SLOT(onDpiTypeChanged(int)));
  connect(m_dpiFld, SIGNAL(editingFinished()), SLOT(onDpiFieldChanged()));
  connect(m_squarePixCB, SIGNAL(stateChanged(int)),
          SLOT(onSquarePixelChanged(int)));
  connect(m_widthFld, SIGNAL(editingFinished()), SLOT(onWidthFieldChanged()));
  connect(m_heightFld, SIGNAL(editingFinished()), SLOT(onHeightFieldChanged()));
  connect(m_useCameraDpiBtn, SIGNAL(clicked()), SLOT(useCameraDpi()));
  connect(m_subsamplingFld, SIGNAL(editingFinished()),
          SLOT(onSubsamplingChanged()));

  /*--- ScanPathの入力に対応 ---*/
  connect(m_scanPathFld, SIGNAL(pathChanged()), SLOT(onScanPathChanged()));
  connect(m_doPremultiply, SIGNAL(stateChanged(int)),
          SLOT(onDoPremultiplyChanged(int)));
  connect(m_doAntialias, SIGNAL(stateChanged(int)),
          SLOT(onDoAntialiasChanged(int)));
  connect(m_antialiasSoftness, SIGNAL(editingFinished()),
          SLOT(onAntialiasSoftnessChanged()));

  connect(m_whiteTransp, SIGNAL(stateChanged(int)),
          SLOT(onWhiteTranspChanged(int)));

  updateLevelSettings();
}
コード例 #26
0
ファイル: tNASBar.cpp プロジェクト: dulton/53_hero
//-----------------------------------------------------------------------------
//! 
//-----------------------------------------------------------------------------
tNASBar::tNASBar( tFusionClientAgent& fusionClientAgent, quint8 sourceId, QWidget* pParent )
: tPanel( pParent )
, m_pSourceIcon( 0 )
, m_pSourceName( 0 )
, m_pStatusIcon( 0 )
, m_pTicker( 0 )
, m_pNotice( 0 )
, m_pTimeRemaining( 0 )
, m_pRepeatIcon( 0 )
, m_pShuffleIcon( 0 )
, m_pVolumeWidget( 0 )
, m_pVolumeAction( 0 )
, m_pMuteAction( 0 )
, m_pPowerAction( 0 )
, m_pSelectAudioServerAction( 0 )
, m_pAudioSourceAction( 0 )
, m_pVirtualHeadAction( 0 )
, m_pZoneSetupAction( 0 )
, m_pOptionsAction( 0 )
, m_pVideoOptionsAction( 0 )
, m_pBluetoothDevicesAction( 0 )
, m_pMixerActions( 0 )
, m_pSettingsMenuAction( 0 )
, m_pOpenDialog( 0 )
, m_pPopupWidget( 0 )
, m_MySourceId( sourceId )
, m_MyZoneId( 0 ) // TODO A: Make this a zone ID
, m_pDummyAction( 0 )
, m_FlashTimerID( -1 )
, m_FlashTime( false )
, m_FlashOn( false )
, m_ButtonPressed( false )
, m_PressedPosition( eCP_None )
, m_FusionClientAgent( fusionClientAgent )
{
    // Should not access the NAS from this constructor
    TRACE_FUNCTION;

    setObjectName( QString( "NasBar%1" ).arg( sourceId ) );

    m_ShowSettingsMenu = false;
    setFocusPolicy( Qt::StrongFocus );

    setAutoFillBackground( true );

    // Setup colours please.
    Connect( tSystemSettings::Instance(), SIGNAL( NightModeChanged(bool, bool) ), this, SLOT( UpdateColors() ));
    Connect( tUiSettings::Instance(), SIGNAL( NightModeTextColorChanged(eNightModeTextColor) ), this, SLOT( UpdateColors() ));   
    tNASBar::UpdateColors();

    setHeight( AudioBarHeight( this ) );

    // Clear the dialog/menu pointers
    m_pMenu = 0;
    m_pVolumeAction = 0;
    m_pMuteAction = 0;
    m_pAudioSourceAction = 0; // Audio sources to choose from
    m_pVirtualHeadAction = 0;
    m_pZoneSetupAction = 0;
    m_pDummyAction = 0;
    m_pPowerAction = 0;
    // use a transparent placeholder for all icons to maintain the size and location of all widgets in the layout
    QPixmap trans28( tPath::ResourceFile( "audio/trans28.png" ) );

    m_pSourceIcon = new QLabel();
    m_pSourceIcon->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred );
    m_pSourceIcon->setPixmap( trans28 );
    m_pSourceIcon->resize( sizeHint() );

    m_pSourceName = new QLabel();
    m_pSourceName->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred );
    
    m_pVertSep1 = new QFrame();
    m_pVertSep1->setFrameShape( QFrame::VLine );
    m_pVertSep1->setMaximumHeight( 24 );

    m_pStatusIcon = new QLabel();
    m_pStatusIcon->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred );
    m_pStatusIcon->hide();

    // only widget i want hidden since the ticker will grow into its unused space.
    m_pTimeRemaining = new QLabel();
    m_pTimeRemaining->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred );
    m_pTimeRemaining->hide();

    m_pVertSep2 = new QFrame();
    m_pVertSep2->setFrameShape( QFrame::VLine );
    m_pVertSep2->setMaximumHeight( 24 );

    m_pRepeatIcon = new QLabel();
    m_pRepeatIcon->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred );
    m_pRepeatIcon->setPixmap( trans28 );
    m_pRepeatIcon->resize( sizeHint() );

    m_pShuffleIcon = new QLabel();
    m_pShuffleIcon->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred );
    m_pShuffleIcon->setPixmap( trans28 );
    m_pShuffleIcon->resize( sizeHint() );

    m_pVolumeWidget = new tVolumeWidget( true, m_FusionClientAgent.IsMuted(), this );
    m_pVolumeWidget->SetRange( m_FusionClientAgent.MinVolumeLevel(), m_FusionClientAgent.MaxVolumeLevel() );
    m_pVolumeWidget->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
    m_pVolumeWidget->resize( 60, ( AudioBarHeight( this ) / 3 ) );

    m_pTicker = new tTicker( this );

    m_pNotice = new tNoticeManager( this );
    m_pNotice->hide();
    Connect( m_pNotice, SIGNAL( ShowMe() ), this, SLOT( NoticeOnTop() ) );
    Connect( m_pNotice, SIGNAL( AllClear() ), this, SLOT( NoticeAllClear() ) );

    QGridLayout* pLayout = new QGridLayout();
    pLayout->setContentsMargins( 4, 0, 4, 0 );
    pLayout->setSpacing( 6 );
    setLayout( pLayout );

    m_pLayout = pLayout;

    pLayout->addWidget( m_pSourceIcon, 0, 0 );
    pLayout->addWidget( m_pSourceName, 0, 1 );
    pLayout->addWidget( m_pVertSep1, 0, 2 );
    pLayout->addWidget( m_pStatusIcon, 0, 3 );
    pLayout->addWidget( m_pTicker, 0, 4 );
    pLayout->addWidget( m_pNotice, 0, 4 );
    m_TimeRemainingColumn = 5;
    pLayout->addWidget( m_pTimeRemaining, 0, m_TimeRemainingColumn );
    pLayout->addWidget( m_pVertSep2, 0, 6 );
    pLayout->addWidget( m_pRepeatIcon, 0, 7 );
    pLayout->addWidget( m_pShuffleIcon, 0, 8 );
    pLayout->addWidget( m_pVolumeWidget, 0, 9 );

    m_MySourceString = m_FusionClientAgent.GetSourceName( m_MySourceId );
}
コード例 #27
0
QgsLayoutDesignerDialog::QgsLayoutDesignerDialog( QWidget *parent, Qt::WindowFlags flags )
  : QMainWindow( parent, flags )
  , mInterface( new QgsAppLayoutDesignerInterface( this ) )
  , mToolsActionGroup( new QActionGroup( this ) )
{
  if ( !sInitializedRegistry )
  {
    initializeRegistry();
  }
  QgsSettings settings;
  int size = settings.value( QStringLiteral( "IconSize" ), QGIS_ICON_SIZE ).toInt();
  setIconSize( QSize( size, size ) );
  setStyleSheet( QgisApp::instance()->styleSheet() );

  setupUi( this );
  setWindowTitle( tr( "QGIS Layout Designer" ) );

  setAttribute( Qt::WA_DeleteOnClose );
#if QT_VERSION >= 0x050600
  setDockOptions( dockOptions() | QMainWindow::GroupedDragging );
#endif

  //create layout view
  QGridLayout *viewLayout = new QGridLayout();
  viewLayout->setSpacing( 0 );
  viewLayout->setMargin( 0 );
  viewLayout->setContentsMargins( 0, 0, 0, 0 );
  centralWidget()->layout()->setSpacing( 0 );
  centralWidget()->layout()->setMargin( 0 );
  centralWidget()->layout()->setContentsMargins( 0, 0, 0, 0 );

  mHorizontalRuler = new QgsLayoutRuler( nullptr, Qt::Horizontal );
  mVerticalRuler = new QgsLayoutRuler( nullptr, Qt::Vertical );
  mRulerLayoutFix = new QWidget();
  mRulerLayoutFix->setAttribute( Qt::WA_NoMousePropagation );
  mRulerLayoutFix->setBackgroundRole( QPalette::Window );
  mRulerLayoutFix->setFixedSize( mVerticalRuler->rulerSize(), mHorizontalRuler->rulerSize() );
  viewLayout->addWidget( mRulerLayoutFix, 0, 0 );
  viewLayout->addWidget( mHorizontalRuler, 0, 1 );
  viewLayout->addWidget( mVerticalRuler, 1, 0 );

  //initial state of rulers
  bool showRulers = settings.value( QStringLiteral( "LayoutDesigner/showRulers" ), true ).toBool();
  mActionShowRulers->setChecked( showRulers );
  mHorizontalRuler->setVisible( showRulers );
  mVerticalRuler->setVisible( showRulers );
  mRulerLayoutFix->setVisible( showRulers );
  mActionShowRulers->blockSignals( false );
  connect( mActionShowRulers, &QAction::triggered, this, &QgsLayoutDesignerDialog::showRulers );

  QMenu *rulerMenu = new QMenu( this );
  rulerMenu->addAction( mActionShowGuides );
  rulerMenu->addAction( mActionSnapGuides );
  rulerMenu->addAction( mActionManageGuides );
  rulerMenu->addAction( mActionClearGuides );
  rulerMenu->addSeparator();
  rulerMenu->addAction( mActionShowRulers );
  mHorizontalRuler->setContextMenu( rulerMenu );
  mVerticalRuler->setContextMenu( rulerMenu );

  connect( mActionRefreshView, &QAction::triggered, this, &QgsLayoutDesignerDialog::refreshLayout );

  connect( mActionShowGrid, &QAction::triggered, this, &QgsLayoutDesignerDialog::showGrid );
  connect( mActionSnapGrid, &QAction::triggered, this, &QgsLayoutDesignerDialog::snapToGrid );

  connect( mActionShowGuides, &QAction::triggered, this, &QgsLayoutDesignerDialog::showGuides );
  connect( mActionSnapGuides, &QAction::triggered, this, &QgsLayoutDesignerDialog::snapToGuides );
  connect( mActionSmartGuides, &QAction::triggered, this, &QgsLayoutDesignerDialog::snapToItems );

  connect( mActionShowBoxes, &QAction::triggered, this, &QgsLayoutDesignerDialog::showBoxes );
  connect( mActionShowPage, &QAction::triggered, this, &QgsLayoutDesignerDialog::showPages );

  mView = new QgsLayoutView();
  //mView->setMapCanvas( mQgis->mapCanvas() );
  mView->setContentsMargins( 0, 0, 0, 0 );
  mView->setHorizontalRuler( mHorizontalRuler );
  mView->setVerticalRuler( mVerticalRuler );
  viewLayout->addWidget( mView, 1, 1 );
  //view does not accept focus via tab
  mView->setFocusPolicy( Qt::ClickFocus );
  mViewFrame->setLayout( viewLayout );
  mViewFrame->setContentsMargins( 0, 0, 0, 1 ); // 1 is deliberate!
  mView->setFrameShape( QFrame::NoFrame );

  connect( mActionClose, &QAction::triggered, this, &QWidget::close );

  // populate with initial items...
  const QList< int > itemMetadataIds = QgsGui::layoutItemGuiRegistry()->itemMetadataIds();
  for ( int id : itemMetadataIds )
  {
    itemTypeAdded( id );
  }
  //..and listen out for new item types
  connect( QgsGui::layoutItemGuiRegistry(), &QgsLayoutItemGuiRegistry::typeAdded, this, &QgsLayoutDesignerDialog::itemTypeAdded );

  QToolButton *orderingToolButton = new QToolButton( this );
  orderingToolButton->setPopupMode( QToolButton::InstantPopup );
  orderingToolButton->setAutoRaise( true );
  orderingToolButton->setToolButtonStyle( Qt::ToolButtonIconOnly );
  orderingToolButton->addAction( mActionRaiseItems );
  orderingToolButton->addAction( mActionLowerItems );
  orderingToolButton->addAction( mActionMoveItemsToTop );
  orderingToolButton->addAction( mActionMoveItemsToBottom );
  orderingToolButton->setDefaultAction( mActionRaiseItems );
  mActionsToolbar->addWidget( orderingToolButton );

  QToolButton *alignToolButton = new QToolButton( this );
  alignToolButton->setPopupMode( QToolButton::InstantPopup );
  alignToolButton->setAutoRaise( true );
  alignToolButton->setToolButtonStyle( Qt::ToolButtonIconOnly );
  alignToolButton->addAction( mActionAlignLeft );
  alignToolButton->addAction( mActionAlignHCenter );
  alignToolButton->addAction( mActionAlignRight );
  alignToolButton->addAction( mActionAlignTop );
  alignToolButton->addAction( mActionAlignVCenter );
  alignToolButton->addAction( mActionAlignBottom );
  alignToolButton->setDefaultAction( mActionAlignLeft );
  mActionsToolbar->addWidget( alignToolButton );

  QToolButton *distributeToolButton = new QToolButton( this );
  distributeToolButton->setPopupMode( QToolButton::InstantPopup );
  distributeToolButton->setAutoRaise( true );
  distributeToolButton->setToolButtonStyle( Qt::ToolButtonIconOnly );
  distributeToolButton->addAction( mActionDistributeLeft );
  distributeToolButton->addAction( mActionDistributeHCenter );
  distributeToolButton->addAction( mActionDistributeRight );
  distributeToolButton->addAction( mActionDistributeTop );
  distributeToolButton->addAction( mActionDistributeVCenter );
  distributeToolButton->addAction( mActionDistributeBottom );
  distributeToolButton->setDefaultAction( mActionDistributeLeft );
  mActionsToolbar->addWidget( distributeToolButton );

  QToolButton *resizeToolButton = new QToolButton( this );
  resizeToolButton->setPopupMode( QToolButton::InstantPopup );
  resizeToolButton->setAutoRaise( true );
  resizeToolButton->setToolButtonStyle( Qt::ToolButtonIconOnly );
  resizeToolButton->addAction( mActionResizeNarrowest );
  resizeToolButton->addAction( mActionResizeWidest );
  resizeToolButton->addAction( mActionResizeShortest );
  resizeToolButton->addAction( mActionResizeTallest );
  resizeToolButton->addAction( mActionResizeToSquare );
  resizeToolButton->setDefaultAction( mActionResizeNarrowest );
  mActionsToolbar->addWidget( resizeToolButton );

  mAddItemTool = new QgsLayoutViewToolAddItem( mView );
  mAddNodeItemTool = new QgsLayoutViewToolAddNodeItem( mView );
  mPanTool = new QgsLayoutViewToolPan( mView );
  mPanTool->setAction( mActionPan );
  mToolsActionGroup->addAction( mActionPan );
  connect( mActionPan, &QAction::triggered, mPanTool, [ = ] { mView->setTool( mPanTool ); } );
  mZoomTool = new QgsLayoutViewToolZoom( mView );
  mZoomTool->setAction( mActionZoomTool );
  mToolsActionGroup->addAction( mActionZoomTool );
  connect( mActionZoomTool, &QAction::triggered, mZoomTool, [ = ] { mView->setTool( mZoomTool ); } );
  mSelectTool = new QgsLayoutViewToolSelect( mView );
  mSelectTool->setAction( mActionSelectMoveItem );
  mToolsActionGroup->addAction( mActionSelectMoveItem );
  connect( mActionSelectMoveItem, &QAction::triggered, mSelectTool, [ = ] { mView->setTool( mSelectTool ); } );
  // after creating an item with the add item tool, switch immediately to select tool
  connect( mAddItemTool, &QgsLayoutViewToolAddItem::createdItem, this, [ = ] { mView->setTool( mSelectTool ); } );
  connect( mAddNodeItemTool, &QgsLayoutViewToolAddNodeItem::createdItem, this, [ = ] { mView->setTool( mSelectTool ); } );

  mNodesTool = new QgsLayoutViewToolEditNodes( mView );
  mNodesTool->setAction( mActionEditNodesItem );
  mToolsActionGroup->addAction( mActionEditNodesItem );
  connect( mActionEditNodesItem, &QAction::triggered, mNodesTool, [ = ] { mView->setTool( mNodesTool ); } );

  mMoveContentTool = new QgsLayoutViewToolMoveItemContent( mView );
  mMoveContentTool->setAction( mActionMoveItemContent );
  mToolsActionGroup->addAction( mActionMoveItemContent );
  connect( mActionMoveItemContent, &QAction::triggered, mMoveContentTool, [ = ] { mView->setTool( mMoveContentTool ); } );

  //Ctrl+= should also trigger zoom in
  QShortcut *ctrlEquals = new QShortcut( QKeySequence( QStringLiteral( "Ctrl+=" ) ), this );
  connect( ctrlEquals, &QShortcut::activated, mActionZoomIn, &QAction::trigger );
  //Backspace should also trigger delete selection
  QShortcut *backSpace = new QShortcut( QKeySequence( QStringLiteral( "Backspace" ) ), this );
  connect( backSpace, &QShortcut::activated, mActionDeleteSelection, &QAction::trigger );

  mActionPreviewModeOff->setChecked( true );
  connect( mActionPreviewModeOff, &QAction::triggered, this, [ = ]
  {
    mView->setPreviewModeEnabled( false );
  } );
  connect( mActionPreviewModeGrayscale, &QAction::triggered, this, [ = ]
  {
    mView->setPreviewMode( QgsPreviewEffect::PreviewGrayscale );
    mView->setPreviewModeEnabled( true );
  } );
  connect( mActionPreviewModeMono, &QAction::triggered, this, [ = ]
  {
    mView->setPreviewMode( QgsPreviewEffect::PreviewMono );
    mView->setPreviewModeEnabled( true );
  } );
  connect( mActionPreviewProtanope, &QAction::triggered, this, [ = ]
  {
    mView->setPreviewMode( QgsPreviewEffect::PreviewProtanope );
    mView->setPreviewModeEnabled( true );
  } );
  connect( mActionPreviewDeuteranope, &QAction::triggered, this, [ = ]
  {
    mView->setPreviewMode( QgsPreviewEffect::PreviewDeuteranope );
    mView->setPreviewModeEnabled( true );
  } );
  QActionGroup *previewGroup = new QActionGroup( this );
  previewGroup->setExclusive( true );
  mActionPreviewModeOff->setActionGroup( previewGroup );
  mActionPreviewModeGrayscale->setActionGroup( previewGroup );
  mActionPreviewModeMono->setActionGroup( previewGroup );
  mActionPreviewProtanope->setActionGroup( previewGroup );
  mActionPreviewDeuteranope->setActionGroup( previewGroup );

  connect( mActionZoomIn, &QAction::triggered, mView, &QgsLayoutView::zoomIn );
  connect( mActionZoomOut, &QAction::triggered, mView, &QgsLayoutView::zoomOut );
  connect( mActionZoomAll, &QAction::triggered, mView, &QgsLayoutView::zoomFull );
  connect( mActionZoomActual, &QAction::triggered, mView, &QgsLayoutView::zoomActual );
  connect( mActionZoomToWidth, &QAction::triggered, mView, &QgsLayoutView::zoomWidth );

  connect( mActionSelectAll, &QAction::triggered, mView, &QgsLayoutView::selectAll );
  connect( mActionDeselectAll, &QAction::triggered, mView, &QgsLayoutView::deselectAll );
  connect( mActionInvertSelection, &QAction::triggered, mView, &QgsLayoutView::invertSelection );
  connect( mActionSelectNextAbove, &QAction::triggered, mView, &QgsLayoutView::selectNextItemAbove );
  connect( mActionSelectNextBelow, &QAction::triggered, mView, &QgsLayoutView::selectNextItemBelow );

  connect( mActionRaiseItems, &QAction::triggered, this, &QgsLayoutDesignerDialog::raiseSelectedItems );
  connect( mActionLowerItems, &QAction::triggered, this, &QgsLayoutDesignerDialog::lowerSelectedItems );
  connect( mActionMoveItemsToTop, &QAction::triggered, this, &QgsLayoutDesignerDialog::moveSelectedItemsToTop );
  connect( mActionMoveItemsToBottom, &QAction::triggered, this, &QgsLayoutDesignerDialog::moveSelectedItemsToBottom );
  connect( mActionAlignLeft, &QAction::triggered, this, [ = ]
  {
    mView->alignSelectedItems( QgsLayoutAligner::AlignLeft );
  } );
  connect( mActionAlignHCenter, &QAction::triggered, this, [ = ]
  {
    mView->alignSelectedItems( QgsLayoutAligner::AlignHCenter );
  } );
  connect( mActionAlignRight, &QAction::triggered, this, [ = ]
  {
    mView->alignSelectedItems( QgsLayoutAligner::AlignRight );
  } );
  connect( mActionAlignTop, &QAction::triggered, this, [ = ]
  {
    mView->alignSelectedItems( QgsLayoutAligner::AlignTop );
  } );
  connect( mActionAlignVCenter, &QAction::triggered, this, [ = ]
  {
    mView->alignSelectedItems( QgsLayoutAligner::AlignVCenter );
  } );
  connect( mActionAlignBottom, &QAction::triggered, this, [ = ]
  {
    mView->alignSelectedItems( QgsLayoutAligner::AlignBottom );
  } );
  connect( mActionDistributeLeft, &QAction::triggered, this, [ = ]
  {
    mView->distributeSelectedItems( QgsLayoutAligner::DistributeLeft );
  } );
  connect( mActionDistributeHCenter, &QAction::triggered, this, [ = ]
  {
    mView->distributeSelectedItems( QgsLayoutAligner::DistributeHCenter );
  } );
  connect( mActionDistributeRight, &QAction::triggered, this, [ = ]
  {
    mView->distributeSelectedItems( QgsLayoutAligner::DistributeRight );
  } );
  connect( mActionDistributeTop, &QAction::triggered, this, [ = ]
  {
    mView->distributeSelectedItems( QgsLayoutAligner::DistributeTop );
  } );
  connect( mActionDistributeVCenter, &QAction::triggered, this, [ = ]
  {
    mView->distributeSelectedItems( QgsLayoutAligner::DistributeVCenter );
  } );
  connect( mActionDistributeBottom, &QAction::triggered, this, [ = ]
  {
    mView->distributeSelectedItems( QgsLayoutAligner::DistributeBottom );
  } );
  connect( mActionResizeNarrowest, &QAction::triggered, this, [ = ]
  {
    mView->resizeSelectedItems( QgsLayoutAligner::ResizeNarrowest );
  } );
  connect( mActionResizeWidest, &QAction::triggered, this, [ = ]
  {
    mView->resizeSelectedItems( QgsLayoutAligner::ResizeWidest );
  } );
  connect( mActionResizeShortest, &QAction::triggered, this, [ = ]
  {
    mView->resizeSelectedItems( QgsLayoutAligner::ResizeShortest );
  } );
  connect( mActionResizeTallest, &QAction::triggered, this, [ = ]
  {
    mView->resizeSelectedItems( QgsLayoutAligner::ResizeTallest );
  } );
  connect( mActionResizeToSquare, &QAction::triggered, this, [ = ]
  {
    mView->resizeSelectedItems( QgsLayoutAligner::ResizeToSquare );
  } );

  connect( mActionAddPages, &QAction::triggered, this, &QgsLayoutDesignerDialog::addPages );

  connect( mActionUnlockAll, &QAction::triggered, this, &QgsLayoutDesignerDialog::unlockAllItems );
  connect( mActionLockItems, &QAction::triggered, this, &QgsLayoutDesignerDialog::lockSelectedItems );

  connect( mActionHidePanels, &QAction::toggled, this, &QgsLayoutDesignerDialog::setPanelVisibility );

  connect( mActionDeleteSelection, &QAction::triggered, this, [ = ]
  {
    if ( mView->tool() == mNodesTool )
      mNodesTool->deleteSelectedNode();
    else
      mView->deleteSelectedItems();
  } );
  connect( mActionGroupItems, &QAction::triggered, this, [ = ]
  {
    mView->groupSelectedItems();
  } );
  connect( mActionUngroupItems, &QAction::triggered, this, [ = ]
  {
    mView->ungroupSelectedItems();
  } );

  //create status bar labels
  mStatusCursorXLabel = new QLabel( mStatusBar );
  mStatusCursorXLabel->setMinimumWidth( 100 );
  mStatusCursorYLabel = new QLabel( mStatusBar );
  mStatusCursorYLabel->setMinimumWidth( 100 );
  mStatusCursorPageLabel = new QLabel( mStatusBar );
  mStatusCursorPageLabel->setMinimumWidth( 100 );

  mStatusBar->addPermanentWidget( mStatusCursorXLabel );
  mStatusBar->addPermanentWidget( mStatusCursorXLabel );
  mStatusBar->addPermanentWidget( mStatusCursorYLabel );
  mStatusBar->addPermanentWidget( mStatusCursorPageLabel );

  mStatusZoomCombo = new QComboBox();
  mStatusZoomCombo->setEditable( true );
  mStatusZoomCombo->setInsertPolicy( QComboBox::NoInsert );
  mStatusZoomCombo->setCompleter( nullptr );
  mStatusZoomCombo->setMinimumWidth( 100 );
  //zoom combo box accepts decimals in the range 1-9999, with an optional decimal point and "%" sign
  QRegularExpression zoomRx( QStringLiteral( "\\s*\\d{1,4}(\\.\\d?)?\\s*%?" ) );
  QValidator *zoomValidator = new QRegularExpressionValidator( zoomRx, mStatusZoomCombo );
  mStatusZoomCombo->lineEdit()->setValidator( zoomValidator );

  Q_FOREACH ( double level, sStatusZoomLevelsList )
  {
    mStatusZoomCombo->insertItem( 0, tr( "%1%" ).arg( level * 100.0, 0, 'f', 1 ), level );
  }
コード例 #28
0
ファイル: predicttabwidget.cpp プロジェクト: opieproject/opie
PredictTabWidget::PredictTabWidget( QWidget *parent )
	: QWidget( parent, 0x0, 0 )
{
/*
	QVBoxLayout *tmpvb = new QVBoxLayout( this );
	QScrollView *sv = new QScrollView( this );
	tmpvb->addWidget( sv, 0, 0 );
	sv->setResizePolicy( QScrollView::AutoOneFit );
	sv->setFrameStyle( QFrame::NoFrame );
	QWidget *container = new QWidget( sv->viewport() );
	sv->addChild( container );
*/

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

	// Predicted time drift
	layout->addWidget( new QLabel( tr( "Predicted time drift" ), this ), 0, 0 );
	lblDrift = new QLabel( tr( "n/a" ), this );
	layout->addWidget( lblDrift, 0, 1 );

	// Estimated time difference
	layout->addWidget( new QLabel( tr( "Estimated shift" ), this ), 1, 0 );
	lblDiff = new QLabel( tr( "n/a" ), this );
	layout->addWidget( lblDiff, 1, 1 );

	// Predicted time
	layout->addWidget( new QLabel( tr( "Predicted time" ), this ), 2, 0 );
	lblPredicted = new QLabel( tr( "n/a" ), this );
	layout->addWidget( lblPredicted, 2, 1 );

	// Prediction table
	tblLookups = new QTable( 2, 3, this );
	QFont font(  tblLookups->font() );
	font.setPointSize( font.pointSize() - 2 );
	tblLookups->setFont( font );
	tblLookups->horizontalHeader()->setLabel( 0, tr( "Shift [s/h]" ) );
	tblLookups->horizontalHeader()->setLabel( 1, tr( "Last [h]" ) );
	tblLookups->horizontalHeader()->setLabel( 2, tr( "Offset [s]" ) );

	tblLookups->setMinimumHeight( 50 );
	tblLookups->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum ) );
	layout->addMultiCellWidget( tblLookups, 3, 3, 0, 1 );

	// Predict time button
	QPushButton *pb = new QPushButton( tr( "Predict time" ), this );
	connect( pb, SIGNAL(clicked()), this, SLOT(slotPredictTime()) );
	layout->addWidget( pb, 4, 0 );

	// Set predicted time button
	pb = new QPushButton( tr( "Set predicted time" ), this );
	connect( pb, SIGNAL(clicked()), this, SLOT(slotSetPredictedTime()) );
	layout->addWidget( pb, 4, 1 );

	// Initialize values
	Config config( "ntp" );
	config.setGroup( "lookups" );
	int lookupCount = config.readNumEntry( "count", 0 );
	float last, shift, shiftPerSec;
	tblLookups->setNumRows( lookupCount );
	int cw = tblLookups->width() / 4;
	cw = 50;
	tblLookups->sortColumn( 0, FALSE, TRUE );
	_shiftPerSec = 0;
	QString grpname;
	for ( int i=0; i < lookupCount; i++ )
	{
		grpname = "lookup_";
		grpname.append( QString::number( i ) );
		config.setGroup( grpname );
		last = config.readEntry( "secsSinceLast", 0 ).toFloat();
		shift = QString( config.readEntry( "timeShift", 0 ) ).toFloat();
		shiftPerSec =  shift / last;
		_shiftPerSec += shiftPerSec;
		tblLookups->setText( i, 0, QString::number( shiftPerSec * 60 * 60 ) );
		tblLookups->setText( i, 2, QString::number( shift ) );
		tblLookups->setText( i, 1, QString::number( last / ( 60 * 60 ) ) );
	}
        if(lookupCount)
	    _shiftPerSec /= lookupCount;
	QString drift = QString::number( _shiftPerSec * 60 * 60);
	drift.append( tr( " s/h" ) );
	lblDrift->setText( drift );

	Config lconfig( "locale" );
	lconfig.setGroup( "Location" );
	tz = lconfig.readEntry( "Timezone", "America/New_York" );
}
コード例 #29
0
RegExpTester::RegExpTester( QWidget* pParent, const QString& autoMergeRegExpToolTip,
   const QString& historyStartRegExpToolTip, const QString& historyEntryStartRegExpToolTip, const QString& historySortKeyOrderToolTip )
: QDialog( pParent)
{
   int line=0;
   setWindowTitle(i18n("Regular Expression Tester"));
   QGridLayout* pGrid = new QGridLayout( this );
   pGrid->setSpacing(5);
   pGrid->setMargin(5);

   QLabel* l = new QLabel(i18n("Auto merge regular expression:"), this);
   pGrid->addWidget(l,line,0);
   l->setToolTip( autoMergeRegExpToolTip );
   m_pAutoMergeRegExpEdit = new QLineEdit(this);
   pGrid->addWidget(m_pAutoMergeRegExpEdit,line,1);
   connect( m_pAutoMergeRegExpEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotRecalc()));
   ++line;

   l = new QLabel(i18n("Example auto merge line:"), this);
   pGrid->addWidget(l,line,0);
   l->setToolTip( i18n("To test auto merge, copy a line as used in your files.") );
   m_pAutoMergeExampleEdit = new QLineEdit(this);
   pGrid->addWidget(m_pAutoMergeExampleEdit,line,1);
   connect( m_pAutoMergeExampleEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotRecalc()));
   ++line;

   l = new QLabel(i18n("Match result:"), this);
   pGrid->addWidget(l,line,0);
   m_pAutoMergeMatchResult = new QLineEdit(this);
   m_pAutoMergeMatchResult->setReadOnly(true);
   pGrid->addWidget(m_pAutoMergeMatchResult,line,1);
   ++line;

   pGrid->addItem( new QSpacerItem(100,20), line, 0 );
   pGrid->setRowStretch( line, 5);
   ++line;

   l = new QLabel(i18n("History start regular expression:"), this);
   pGrid->addWidget(l,line,0);
   l->setToolTip( historyStartRegExpToolTip );
   m_pHistoryStartRegExpEdit = new QLineEdit(this);
   pGrid->addWidget(m_pHistoryStartRegExpEdit,line,1);
   connect( m_pHistoryStartRegExpEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotRecalc()));
   ++line;

   l = new QLabel(i18n("Example history start line (with leading comment):"), this);
   pGrid->addWidget(l,line,0);
   l->setToolTip( i18n("Copy a history start line as used in your files,\n"
                          "including the leading comment.") );
   m_pHistoryStartExampleEdit = new QLineEdit(this);
   pGrid->addWidget(m_pHistoryStartExampleEdit,line,1);
   connect( m_pHistoryStartExampleEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotRecalc()));
   ++line;

   l = new QLabel(i18n("Match result:"), this);
   pGrid->addWidget(l,line,0);
   m_pHistoryStartMatchResult = new QLineEdit(this);
   m_pHistoryStartMatchResult->setReadOnly(true);
   pGrid->addWidget(m_pHistoryStartMatchResult,line,1);
   ++line;

   pGrid->addItem( new QSpacerItem(100,20), line, 0 );
   pGrid->setRowStretch( line, 5);
   ++line;

   l = new QLabel(i18n("History entry start regular expression:"), this);
   pGrid->addWidget(l,line,0);
   l->setToolTip( historyEntryStartRegExpToolTip );
   m_pHistoryEntryStartRegExpEdit = new QLineEdit(this);
   pGrid->addWidget(m_pHistoryEntryStartRegExpEdit,line,1);
   connect( m_pHistoryEntryStartRegExpEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotRecalc()));
   ++line;

   l = new QLabel(i18n("History sort key order:"), this);
   pGrid->addWidget(l,line,0);
   l->setToolTip( historySortKeyOrderToolTip );
   m_pHistorySortKeyOrderEdit = new QLineEdit(this);
   pGrid->addWidget(m_pHistorySortKeyOrderEdit,line,1);
   connect( m_pHistorySortKeyOrderEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotRecalc()));
   ++line;

   l = new QLabel(i18n("Example history entry start line (without leading comment):"), this);
   pGrid->addWidget(l,line,0);
   l->setToolTip( i18n("Copy a history entry start line as used in your files,\n"
                          "but omit the leading comment.") );
   m_pHistoryEntryStartExampleEdit = new QLineEdit(this);
   pGrid->addWidget(m_pHistoryEntryStartExampleEdit,line,1);
   connect( m_pHistoryEntryStartExampleEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotRecalc()));
   ++line;

   l = new QLabel(i18n("Match result:"), this);
   pGrid->addWidget(l,line,0);
   m_pHistoryEntryStartMatchResult = new QLineEdit(this);
   m_pHistoryEntryStartMatchResult->setReadOnly(true);
   pGrid->addWidget(m_pHistoryEntryStartMatchResult,line,1);
   ++line;

   l = new QLabel(i18n("Sort key result:"), this);
   pGrid->addWidget(l,line,0);
   m_pHistorySortKeyResult = new QLineEdit(this);
   m_pHistorySortKeyResult->setReadOnly(true);
   pGrid->addWidget(m_pHistorySortKeyResult,line,1);
   ++line;

   QPushButton* pButton = new QPushButton(i18n("OK"), this);
   pGrid->addWidget(pButton,line,0);
   connect( pButton, SIGNAL(clicked()), this, SLOT(accept()));

   pButton = new QPushButton(i18n("Cancel"), this);
   pGrid->addWidget(pButton,line,1);
   connect( pButton, SIGNAL(clicked()), this, SLOT(reject()));

   resize( 800, sizeHint().height() );
}
コード例 #30
0
ファイル: KviIrcView_tools.cpp プロジェクト: philouvb/KVIrc
KviIrcViewToolWidget::KviIrcViewToolWidget(KviIrcView * pParent)
: QWidget(pParent)
{
	m_pIrcView = pParent;
	setAutoFillBackground(true);
	setContentsMargins(0,0,0,0);

	QHBoxLayout * pLayout = new QHBoxLayout(this);
	pLayout->setMargin(2);
	pLayout->setSpacing(2);

	QPushButton * pButton = new QPushButton(QIcon(*g_pIconManager->getSmallIcon(KviIconManager::Close)), QString(),this);
	pButton->setFixedSize(16,16);
	pButton->setFlat(true);
	connect(pButton,SIGNAL(clicked()),m_pIrcView,SLOT(toggleToolWidget()));
	pLayout->addWidget(pButton);

	m_pStringToFind = new KviThemedLineEdit(this, m_pIrcView->parentKviWindow(), "search_lineedit");
	pLayout->addWidget(m_pStringToFind);
	connect(m_pStringToFind,SIGNAL(returnPressed()),this,SLOT(findNext()));
	connect(m_pStringToFind,SIGNAL(textChanged(QString)),this,SLOT(findNextHelper(QString)));

	pButton = new QPushButton(__tr2qs("&Next"),this);
	pButton->setDefault(true);
	connect(pButton,SIGNAL(clicked()),this,SLOT(findNext()));
	pLayout->addWidget(pButton);

	pButton = new QPushButton(__tr2qs("&Previous"),this);
	connect(pButton,SIGNAL(clicked()),this,SLOT(findPrev()));
	pLayout->addWidget(pButton);

	m_pOptionsButton = new QPushButton(this);
	m_pOptionsButton->setText(__tr2qs("&Options"));
	pLayout->addWidget(m_pOptionsButton);

	m_pOptionsWidget = new QMenu(m_pOptionsButton);
	QGridLayout * pOptionsLayout = new QGridLayout(m_pOptionsWidget);
	pOptionsLayout->setSpacing(2);

	connect(m_pOptionsButton, SIGNAL(clicked()), this, SLOT(toggleOptions()));

	// Filter tab

	QLabel * pLabel = new QLabel(__tr2qs("Message types"), m_pOptionsWidget);
	pOptionsLayout->addWidget(pLabel,0,0,1,2);

	m_pFilterView = new QTreeWidget(m_pOptionsWidget);
	m_pFilterView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	m_pFilterView->setRootIsDecorated(false);
	//FIXME hardcoded size sucks
	m_pFilterView->setMinimumSize(QSize(200,150));
	m_pFilterView->setColumnCount(1);
	m_pFilterView->header()->hide();
	pOptionsLayout->addWidget(m_pFilterView,1,0,4,2);

	m_pFilterItems = (KviIrcMessageCheckListItem **)KviMemory::allocate(KVI_NUM_MSGTYPE_OPTIONS * sizeof(KviIrcMessageCheckListItem *));

	for(int i=0;i<KVI_NUM_MSGTYPE_OPTIONS;i++)
	{
		m_pFilterItems[i] = new KviIrcMessageCheckListItem(m_pFilterView,this,i);
	}

	pButton = new QPushButton(__tr2qs("Set &All"),m_pOptionsWidget);
	connect(pButton,SIGNAL(clicked()),this,SLOT(filterEnableAll()));
	pOptionsLayout->addWidget(pButton,6,0);

	pButton = new QPushButton(__tr2qs("Set &None"),m_pOptionsWidget);
	connect(pButton,SIGNAL(clicked()),this,SLOT(filterEnableNone()));
	pOptionsLayout->addWidget(pButton,6,1);

	pButton = new QPushButton(__tr2qs("&Load From..."),m_pOptionsWidget);
	connect(pButton,SIGNAL(clicked()),this,SLOT(filterLoad()));
	pOptionsLayout->addWidget(pButton,7,0);

	pButton = new QPushButton(__tr2qs("&Save As..."),m_pOptionsWidget);
	connect(pButton,SIGNAL(clicked()),this,SLOT(filterSave()));
	pOptionsLayout->addWidget(pButton,7,1);

	pLabel = new QLabel(__tr2qs("Pattern:"),m_pOptionsWidget);
	pOptionsLayout->addWidget(pLabel,8,0);
	m_pSearchMode = new QComboBox(m_pOptionsWidget);
    m_pSearchMode->insertItem(PlainText, __tr2qs("Plain Text"));
    m_pSearchMode->insertItem(Wildcards, __tr2qs("Wildcards"));
    m_pSearchMode->insertItem(RegExp, __tr2qs("RegExp"));
	pOptionsLayout->addWidget(m_pSearchMode,8,1);

	pLabel = new QLabel(__tr2qs("Match:"),m_pOptionsWidget);
	pOptionsLayout->addWidget(pLabel,9,0);

	m_pCaseSensitive = new QCheckBox(__tr2qs("&Case sensitive"),m_pOptionsWidget);
	pOptionsLayout->addWidget(m_pCaseSensitive,9,1);

// 	m_pFindResult = new QLabel(this);
// 	m_pFindResult->setFrameStyle(QFrame::Sunken | QFrame::StyledPanel);
// 	pOptionsLayout->addWidget(m_pFindResult,0,6);

	// Focussing the 'string to find' widget has been moved to the toggle function so that it happens whenever the widget is shown

	KviShortcut::create(Qt::Key_Escape,m_pIrcView,SLOT(toggleToolWidget()),0,Qt::WidgetWithChildrenShortcut);
	KviShortcut::create(KVI_SHORTCUTS_WIN_SEARCH,m_pIrcView,SLOT(toggleToolWidget()),0,Qt::WidgetWithChildrenShortcut);
}