コード例 #1
0
void DlgSettingsExportFormat::createRelationsPointsSelection (QHBoxLayout *layoutRelations)
{
  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::createRelationsPointsSelection";

  QGroupBox *groupPointsSelection = new QGroupBox (tr ("Relation Points Selection"));
  layoutRelations->addWidget (groupPointsSelection);

  QGridLayout *layoutPointsSelections = new QGridLayout;
  groupPointsSelection->setLayout (layoutPointsSelections);

  layoutPointsSelections->setColumnMinimumWidth(0, MIN_INDENT_COLUMN_WIDTH);
  layoutPointsSelections->setColumnStretch (0, 0);
  layoutPointsSelections->setColumnStretch (1, 0);
  layoutPointsSelections->setColumnStretch (2, 0);
  layoutPointsSelections->setColumnStretch (3, 1);

  int row = 0;

  m_btnRelationsPointsEvenlySpaced = new QRadioButton (tr ("Interpolate Xs and Ys at evenly spaced intervals."));
  m_btnRelationsPointsEvenlySpaced->setWhatsThis (tr ("Exported file will have points evenly spaced along each relation, separated by the interval "
                                                      "selected below. If the last interval does not end at the last point, then a shorter last interval "
                                                      "is added that ends on the last point."));
  layoutPointsSelections->addWidget (m_btnRelationsPointsEvenlySpaced, row++, 0, 1, 4);
  connect (m_btnRelationsPointsEvenlySpaced, SIGNAL (released()), this, SLOT (slotRelationsPointsEvenlySpaced()));

  QLabel *labelInterval = new QLabel (tr ("Interval:"));
  layoutPointsSelections->addWidget (labelInterval, row, 1, 1, 1, Qt::AlignRight);

  m_editRelationsPointsEvenlySpacing = new QLineEdit;
  m_validatorRelationsPointsEvenlySpacing = new QDoubleValidator; // Minimum value, to prevent overflow, is set later according to settings
  m_editRelationsPointsEvenlySpacing->setValidator (m_validatorRelationsPointsEvenlySpacing);
  m_editRelationsPointsEvenlySpacing->setMinimumWidth (MIN_EDIT_WIDTH);
  m_editRelationsPointsEvenlySpacing->setMaximumWidth (MAX_EDIT_WIDTH);
  m_editRelationsPointsEvenlySpacing->setWhatsThis (tr ("Interval between successive points when "
                                                        "exporting at evenly spaced (X,Y) coordinates."));
  layoutPointsSelections->addWidget (m_editRelationsPointsEvenlySpacing, row, 2, 1, 1, Qt::AlignLeft);
  connect (m_editRelationsPointsEvenlySpacing, SIGNAL (textChanged(const QString &)), this, SLOT (slotRelationsPointsEvenlySpacedInterval(const QString &)));

  m_cmbRelationsPointsEvenlySpacingUnits = new QComboBox;
  m_cmbRelationsPointsEvenlySpacingUnits->setWhatsThis (tr ("Units for spacing interval.\n\n"
                                                            "Pixel units are preferred when the spacing is to be independent of the X and Y scales. The spacing will be "
                                                            "consistent across the graph, even if a scale is logarithmic or the X and Y scales are different.\n\n"
                                                            "Graph units are usually preferred when the X and Y scales are identical."));
  m_cmbRelationsPointsEvenlySpacingUnits->addItem(exportPointsIntervalUnitsToString (EXPORT_POINTS_INTERVAL_UNITS_GRAPH),
                                                                                     QVariant (EXPORT_POINTS_INTERVAL_UNITS_GRAPH));
  m_cmbRelationsPointsEvenlySpacingUnits->addItem(exportPointsIntervalUnitsToString (EXPORT_POINTS_INTERVAL_UNITS_SCREEN),
                                                                                     QVariant (EXPORT_POINTS_INTERVAL_UNITS_SCREEN));
  connect (m_cmbRelationsPointsEvenlySpacingUnits, SIGNAL (activated (const QString &)),
           this, SLOT (slotRelationsPointsEvenlySpacedIntervalUnits (const QString &))); // activated() ignores code changes
  layoutPointsSelections->addWidget (m_cmbRelationsPointsEvenlySpacingUnits, row++, 3, 1, 1, Qt::AlignLeft);

  m_btnRelationsPointsRaw = new QRadioButton (tr ("Raw Xs and Ys"));
  m_btnRelationsPointsRaw->setWhatsThis (tr ("Exported file will have only original X and Y values"));
  layoutPointsSelections->addWidget (m_btnRelationsPointsRaw, row++, 0, 1, 4);
  connect (m_btnRelationsPointsRaw, SIGNAL (released()), this, SLOT (slotRelationsPointsRaw()));
}
コード例 #2
0
WebbrowserWidget::WebbrowserWidget(QWidget* parent_)
    : QDialog(parent_)
    , widthSpinBox_(0)
    , heightSpinBox_(0)
{
    setWindowTitle(tr("Open Webbrowser"));

    // URL input

    QLabel* urlLabel = new QLabel("Url: ", this);
    urlLineEdit_ = new QLineEdit(WEBBROWSER_DEFAULT_URL, this);
    urlLabel->setBuddy(urlLineEdit_);

    // Standard buttons

    QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok |
                                                       QDialogButtonBox::Cancel,
                                                       Qt::Horizontal, this);

    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    // Webbrowser dimensions

    QLabel* widthLabel = new QLabel("Width: ", this);

    widthSpinBox_ = new QSpinBox(this);
    widthSpinBox_->setMinimum(SPIN_BOX_MIN_VALUE);
    widthSpinBox_->setMaximum(SPIN_BOX_MAX_VALUE);
    widthSpinBox_->setValue(WEBBROWSER_DEFAULT_WIDTH);

    QLabel* heightLabel = new QLabel("Height: ", this);

    heightSpinBox_ = new QSpinBox(this);
    heightSpinBox_->setMinimum(SPIN_BOX_MIN_VALUE);
    heightSpinBox_->setMaximum(SPIN_BOX_MAX_VALUE);
    heightSpinBox_->setValue(WEBBROWSER_DEFAULT_HEIGHT);

    // Layout

    QGridLayout *gridLayout = new QGridLayout;
    gridLayout->setColumnStretch(1, 1);
    gridLayout->setColumnMinimumWidth(1, 250);
    setLayout(gridLayout);

    gridLayout->addWidget(urlLabel, 0, 0);
    gridLayout->addWidget(urlLineEdit_, 0, 1);

    gridLayout->addWidget(widthLabel, 1, 0);
    gridLayout->addWidget(widthSpinBox_, 1, 1);

    gridLayout->addWidget(heightLabel, 2, 0);
    gridLayout->addWidget(heightSpinBox_, 2, 1);

    gridLayout->addWidget(buttonBox, 3, 1);
}
コード例 #3
0
ファイル: RegisterView.cpp プロジェクト: MipScope/mipscope
RegisterPane::RegisterPane(RegisterView *regView) : QWidget(), 
   m_parent(regView), m_widget(new CustomBackgroundWidget(QString(IMAGES"/registerBackground.jpg"), this)) 
{
   QGridLayout *l = new QGridLayout();

   int max = 32;// + 3;
   for(int i = max; i--;) {
      int col = (i >> 3) * 3, row = (i & 7);
      
      m_registerLabels[i] = new IDLabel(this, i);
      l->addWidget(m_registerLabels[i], row, col);
      l->addWidget(m_registerLabels[i]->getValueLabel(), row, col + 1);
   }
   
   for(int i = NO_REGISTERS - max; i--;) {
      int row = 10, col = i * 3, index = 32 + i;
      
      m_registerLabels[index] = new IDLabel(this, index);
      l->addWidget(m_registerLabels[index], row, col);
      l->addWidget(m_registerLabels[index]->getValueLabel(), row, col + 1);
   }
   
   for(int i = 3; i--;)
      l->setColumnMinimumWidth(2 + 3 * i, 14);

   l->setRowMinimumHeight(9, 11);
/*   QColor orange(255, 213, 141);
   QSize size(8, 8);
   for(int i = 10; i--;)
      for(int j = 3; j--;)
         l->addWidget(new CustomSpacer(orange, size, this), i, 2 + 3 * j);*/

   for(int i = 12; i--;)
      l->setColumnStretch(i, 1);
   for(int i = 11; i--;)
      l->setRowStretch(i, 1);
   
   l->setSpacing(0);
   m_widget->setLayout(l);
   
   /*QPalette p = m_widget->palette();
   p.setBrush(QPalette::Window, QPixmap(QString(IMAGES"/registerBackground.jpg")));
   m_widget->setPalette(p);*/
   
   l = new QGridLayout();
   l->setMargin(0);
   l->addWidget(m_widget, 0, 0);//, Qt::AlignCenter);
   setLayout(l);

   // clear all watchpoints and hide the extended-tip view
   memset(m_watchPoints, 0, sizeof(bool) * register_count);
   
   m_extended = new ExtendedView(this, m_widget);
   m_extended->hide();
}
コード例 #4
0
InputDlg::InputDlg()
{

    setWindowTitle(tr("Input Dialog"));

    label1 = new QLabel(tr("Name : "));
    label2 = new QLabel(tr("Sex : "));
    label3 = new QLabel(tr("Age : "));
    label4 = new QLabel(tr("Stature : "));
    
    nameLabel = new QLabel(tr("LiMing"));
    nameLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
    sexLabel = new QLabel(tr("male"));
    sexLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
    ageLabel = new QLabel(tr("25"));
    ageLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
    statureLabel = new QLabel("175.5");
    statureLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
    
    nameButton = new QPushButton;
    nameButton->setIcon(QIcon(":/images/btn.png"));
    sexButton = new QPushButton;
    sexButton->setIcon(QIcon(":/images/btn.png"));
    ageButton = new QPushButton;
    ageButton->setIcon(QIcon(":/images/btn.png"));
    statureButton = new QPushButton;
    statureButton->setIcon(QIcon(":/images/btn.png"));
    

    QGridLayout *layout = new QGridLayout( this );
    int name = 0;
    int sex = 1;
    int age = 2;
    int stature = 3;
    layout->addWidget( label1, name, 0 );	
    layout->addWidget( nameLabel, name, 1 );
    layout->addWidget( nameButton, name, 2 );
    layout->addWidget( label2, sex, 0 );
    layout->addWidget( sexLabel, sex, 1 );
    layout->addWidget( sexButton, sex, 2 );
    layout->addWidget( label3, age, 0 );
    layout->addWidget( ageLabel, age, 1 );
    layout->addWidget( ageButton, age, 2 );
    layout->addWidget( label4, stature, 0 );
    layout->addWidget( statureLabel, stature, 1 );
    layout->addWidget( statureButton, stature, 2 );
    layout->setMargin(15);
    layout->setSpacing(10);
    layout->setColumnMinimumWidth(1,120);
    
    connect(nameButton,SIGNAL(clicked()),this,SLOT(slotName()));
    connect(sexButton,SIGNAL(clicked()),this,SLOT(slotSex()));
    connect(ageButton,SIGNAL(clicked()),this,SLOT(slotAge()));
    connect(statureButton,SIGNAL(clicked()),this,SLOT(slotStature()));
}
コード例 #5
0
//! [14]
CodeStylePage::CodeStylePage(QWidget *parent)
    : QWizardPage(parent)
{
    setTitle(tr("Code Style Options"));
    setSubTitle(tr("Choose the formatting of the generated code."));
    setPixmap(QWizard::LogoPixmap, QPixmap(":/images/logo2.png"));

    commentCheckBox = new QCheckBox(tr("&Start generated files with a "
//! [14]
                                       "comment"));
    commentCheckBox->setChecked(true);

    protectCheckBox = new QCheckBox(tr("&Protect header file against multiple "
                                       "inclusions"));
    protectCheckBox->setChecked(true);

    macroNameLabel = new QLabel(tr("&Macro name:"));
    macroNameLineEdit = new QLineEdit;
    macroNameLabel->setBuddy(macroNameLineEdit);

    includeBaseCheckBox = new QCheckBox(tr("&Include base class definition"));
    baseIncludeLabel = new QLabel(tr("Base class include:"));
    baseIncludeLineEdit = new QLineEdit;
    baseIncludeLabel->setBuddy(baseIncludeLineEdit);

    connect(protectCheckBox, SIGNAL(toggled(bool)),
            macroNameLabel, SLOT(setEnabled(bool)));
    connect(protectCheckBox, SIGNAL(toggled(bool)),
            macroNameLineEdit, SLOT(setEnabled(bool)));
    connect(includeBaseCheckBox, SIGNAL(toggled(bool)),
            baseIncludeLabel, SLOT(setEnabled(bool)));
    connect(includeBaseCheckBox, SIGNAL(toggled(bool)),
            baseIncludeLineEdit, SLOT(setEnabled(bool)));

    registerField("comment", commentCheckBox);
    registerField("protect", protectCheckBox);
    registerField("macroName", macroNameLineEdit);
    registerField("includeBase", includeBaseCheckBox);
    registerField("baseInclude", baseIncludeLineEdit);

    QGridLayout *layout = new QGridLayout;
    layout->setColumnMinimumWidth(0, 20);
    layout->addWidget(commentCheckBox, 0, 0, 1, 3);
    layout->addWidget(protectCheckBox, 1, 0, 1, 3);
    layout->addWidget(macroNameLabel, 2, 1);
    layout->addWidget(macroNameLineEdit, 2, 2);
    layout->addWidget(includeBaseCheckBox, 3, 0, 1, 3);
    layout->addWidget(baseIncludeLabel, 4, 1);
    layout->addWidget(baseIncludeLineEdit, 4, 2);
//! [15]
    setLayout(layout);
}
コード例 #6
0
UIWizardNewVMPageBasic3::UIWizardNewVMPageBasic3()
{
    /* Create widgets: */
    QVBoxLayout *pMainLayout = new QVBoxLayout(this);
    {
        m_pLabel = new QIRichTextLabel(this);
        QGridLayout *pDiskLayout = new QGridLayout;
        {
            m_pDiskSkip = new QRadioButton(this);
            m_pDiskCreate = new QRadioButton(this);
            m_pDiskPresent = new QRadioButton(this);
            QStyleOptionButton options;
            options.initFrom(m_pDiskPresent);
            int iWidth = m_pDiskPresent->style()->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth, &options, m_pDiskPresent);
            pDiskLayout->setColumnMinimumWidth(0, iWidth);
            m_pDiskSelector = new VBoxMediaComboBox(this);
            {
                m_pDiskSelector->setType(UIMediumType_HardDisk);
                m_pDiskSelector->repopulate();
            }
            m_pVMMButton = new QIToolButton(this);
            {
                m_pVMMButton->setAutoRaise(true);
                m_pVMMButton->setIcon(UIIconPool::iconSet(":/select_file_16px.png", ":/select_file_disabled_16px.png"));
            }
            pDiskLayout->addWidget(m_pDiskSkip, 0, 0, 1, 3);
            pDiskLayout->addWidget(m_pDiskCreate, 1, 0, 1, 3);
            pDiskLayout->addWidget(m_pDiskPresent, 2, 0, 1, 3);
            pDiskLayout->addWidget(m_pDiskSelector, 3, 1);
            pDiskLayout->addWidget(m_pVMMButton, 3, 2);
        }
        pMainLayout->addWidget(m_pLabel);
        pMainLayout->addLayout(pDiskLayout);
        pMainLayout->addStretch();
        updateVirtualDiskSource();
    }

    /* Setup connections: */
    connect(m_pDiskSkip, SIGNAL(toggled(bool)), this, SLOT(sltVirtualDiskSourceChanged()));
    connect(m_pDiskCreate, SIGNAL(toggled(bool)), this, SLOT(sltVirtualDiskSourceChanged()));
    connect(m_pDiskPresent, SIGNAL(toggled(bool)), this, SLOT(sltVirtualDiskSourceChanged()));
    connect(m_pDiskSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(sltVirtualDiskSourceChanged()));
    connect(m_pVMMButton, SIGNAL(clicked()), this, SLOT(sltGetWithFileOpenDialog()));

    /* Register classes: */
    qRegisterMetaType<CMedium>();
    /* Register fields: */
    registerField("virtualDisk", this, "virtualDisk");
    registerField("virtualDiskId", this, "virtualDiskId");
    registerField("virtualDiskName", this, "virtualDiskName");
    registerField("virtualDiskLocation", this, "virtualDiskLocation");
}
コード例 #7
0
ファイル: login_window.cpp プロジェクト: budokaii/ozifi
TLoginWindow::TLoginWindow()
    : QWidget(NULL)
{
    qDebug() << Q_FUNC_INFO;
    this->setFixedSize(LOGIN_WINDOW_WIDTH, LOGIN_WINDOW_HEIGHT_NOCAPTCHA);
    this->setGeometry(QDesktopWidget().availableGeometry().center().x() - (this->width() / 2),
                      QDesktopWidget().availableGeometry().center().y() - (this->height() / 2),
                       this->width(), this->height());

    QGridLayout* layout = new QGridLayout(this);

    QLabel* loginLabel = new QLabel(tr("Login:"******"Password:"******"Captcha:"), this);
    layout->addWidget(captchaLabel, 3, 0);

    LoginEdit = new QLineEdit(this);
    layout->addWidget(LoginEdit, 0, 1);

    PasswordEdit = new QLineEdit(this);
    layout->addWidget(PasswordEdit, 1, 1);

    CaptchaEdit = new QLineEdit(this);
    layout->addWidget(CaptchaEdit, 3, 1);
    CaptchaEdit->setEnabled(false);

    LoginButton = new QPushButton(tr("Login"), this);
    connect(LoginButton.data(), &QPushButton::clicked, this,
            &TLoginWindow::OnLoginButtonClicked);
    layout->addWidget(LoginButton, 4, 0);

    RegisterButton = new QPushButton(tr("Register"), this);
    connect(RegisterButton.data(), &QPushButton::clicked, this,
            &TLoginWindow::OnRegisterButtonClicked);
    layout->addWidget(RegisterButton, 4, 1);


    layout->setColumnMinimumWidth(0, 120);
    layout->setColumnMinimumWidth(1, 120);

    this->show();
}
コード例 #8
0
ファイル: top_menu.cpp プロジェクト: seub/CirclePackings
void Top_Menu::print()
{
    print_dialog_ = new QDialog;
    print_dialog_->setWindowTitle("Print in file...");
    QGridLayout *layout = new QGridLayout;
    QLabel *canvas_label = new QLabel;
    canvas_choice_ = new QComboBox;
    QLabel *quality_label = new QLabel;
    quality_spinbox_ = new QSpinBox;
    QLabel *file_label = new QLabel;
    QPushButton *browse_button = new QPushButton;
    print_button_ = new QPushButton;
    QPushButton *cancel_button = new QPushButton;
    file_name_ = new QLineEdit;
    file_name_->setText("CP.png");

    canvas_label->setText(tr("Canvas: "));
    canvas_choice_->addItem("left", 0);
    canvas_choice_->addItem("right",1);
    quality_label->setText(tr("Quality:  "));
    quality_spinbox_->setRange(0,100);
    quality_spinbox_->setValue(80);
    file_label->setText("Filename: ");
    browse_button->setText(tr("Browse..."));
    print_button_->setText(tr("Print"));
    cancel_button->setText(tr("Cancel"));
    connect(browse_button,SIGNAL(clicked()),this,SLOT(browse()));
    connect(cancel_button,SIGNAL(clicked()),print_dialog_,SLOT(close()));
    connect(print_button_,SIGNAL(clicked()),this,SLOT(print_in_file()));
    connect(file_name_,SIGNAL(textChanged(QString)),this,SLOT(print_file_name_changed(QString)));
    layout->setVerticalSpacing(15);
    layout->setRowMinimumHeight(3, 20);
    layout->setColumnMinimumWidth(4, 60);

    layout->addWidget(canvas_label,0,0,1,1);
    layout->addWidget(canvas_choice_,0,1);
    layout->addWidget(quality_label,0,5,1,1,Qt::AlignRight);
    layout->addWidget(quality_spinbox_,0,6,1,1);
    layout->addWidget(file_label,2,0,1,1);
    layout->addWidget(file_name_,2,1,1,5);
    layout->addWidget(browse_button,2,6,1,2);

    layout->addWidget(print_button_,4,6,1,2);
    layout->addWidget(cancel_button,4,5,1,1);
    print_dialog_->setLayout(layout);

    print_button_->setDefault(true);
    print_dialog_->show();
}
コード例 #9
0
ファイル: inspectorgaslift.cpp プロジェクト: iocenter/ResOpt
InspectorGasLift::InspectorGasLift(double time, double value, double max, double min, QWidget *parent, bool header):
    QWidget(parent)
{
    QGridLayout *layout = new QGridLayout(this);
    setLayout(layout);

    int row = 0;

    // creating header if specified
    if(header)
    {
        QLabel *time_header = new QLabel("time", this);
        time_header->setMinimumWidth(80);
        layout->addWidget(time_header, row, 0, Qt::AlignCenter);
        layout->addWidget(new QLabel("value", this), row, 1, Qt::AlignCenter);
        layout->addWidget(new QLabel("max", this), row, 2, Qt::AlignCenter);
        layout->addWidget(new QLabel("min", this), row, 3, Qt::AlignCenter);

        layout->setColumnMinimumWidth(4, 60);


        row++;
    }

    // setting up the components

    p_time = new QLabel(QString::number(time), this);
    p_time->setMinimumWidth(80);
    layout->addWidget(p_time, row, 0, Qt::AlignCenter);

    p_value = new QLineEdit(QString::number(value), this);
    p_value->setFixedWidth(100);
    p_value->setValidator(new QDoubleValidator(this));
    layout->addWidget(p_value, row, 1);

    p_max = new QLineEdit(QString::number(max), this);
    p_max->setFixedWidth(100);
    p_max->setValidator(new QDoubleValidator(this));
    layout->addWidget(p_max, row, 2);

    p_min = new QLineEdit(QString::number(min), this);
    p_min->setFixedWidth(100);
    p_min->setValidator(new QDoubleValidator(this));
    layout->addWidget(p_min, row, 3);



}
コード例 #10
0
MainWindow::MainWindow(const QString &artistTable, const QString &albumTable,
                       QFile *albumDetails, QWidget *parent)
     : QMainWindow(parent)
{
    file = albumDetails;
    readAlbumData();

    model = new QSqlRelationalTableModel(this);
    model->setTable(albumTable);
    model->setRelation(2, QSqlRelation(artistTable, "id", "artist"));
    model->select();

    QGroupBox *artists = createArtistGroupBox();
    QGroupBox *albums = createAlbumGroupBox();
    QGroupBox *details = createDetailsGroupBox();

    artistView->setCurrentIndex(0);
    uniqueAlbumId = model->rowCount();
    uniqueArtistId = artistView->count();

    connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)),
            this, SLOT(updateHeader(QModelIndex,int,int)));
    connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
            this, SLOT(updateHeader(QModelIndex,int,int)));

    QGridLayout *layout = new QGridLayout;
    layout->addWidget(artists, 0, 0);
    layout->addWidget(albums, 1, 0);
    layout->addWidget(details, 0, 1, 2, 1);
#if !defined(Q_OS_SYMBIAN) && !defined(Q_WS_MAEMO_5)
    layout->setColumnStretch(1, 1);
    layout->setColumnMinimumWidth(0, 500);
#endif

    QWidget *widget = new QWidget;
    widget->setLayout(layout);
    setCentralWidget(widget);
    createMenuBar();

    showImageLabel();
#if !defined(Q_OS_SYMBIAN) && !defined(Q_WS_MAEMO_5)
    resize(850, 400);
#endif
    setWindowTitle(tr("Music Archive"));
}
コード例 #11
0
void TlenCreateAccountWidget::createGui()
{
	QGridLayout *gridLayout = new QGridLayout(this);
	gridLayout->setSpacing(5);

	gridLayout->setColumnMinimumWidth(0, 20);
	gridLayout->setColumnStretch(3, 10);

	int row = 0;

	QLabel *nameLabel = new QLabel(tr("Account name") + ":", this);
	gridLayout->addWidget(nameLabel, row, 1, Qt::AlignRight);
	AccountName = new QLineEdit(this);
	gridLayout->addWidget(AccountName, row++, 2, 1, 2);

	createAccountGui(gridLayout, row);
	// TODO: register support
}
コード例 #12
0
ファイル: MainWindow.cpp プロジェクト: alelos/SciVis-Project
MainWindow::MainWindow(string dirname, string filename, QWidget *parent) : vr(dirname), h(dirname), m_rowToRemove(0) {
    center = new QWidget(this) ;       /* center widget, holds everything together */
    //center->setMinimumSize(600,480) ;
    createSettingsBox() ;
    createOpacityBox() ;

    QGridLayout *centerLayout = new QGridLayout ;
    centerLayout->setColumnMinimumWidth(0,400);
    centerLayout->setColumnMinimumWidth(1,300);
    centerLayout->setRowMinimumHeight(0, 350);
    centerLayout->setRowMinimumHeight(1, 150);
    //centerLayout->setRowMinimumHeight(2, 150);
    centerLayout->addWidget(vr.getRenderWindow(),0, 0) ;
    centerLayout->addWidget(h.getRenderWindow(),1, 0) ;
    centerLayout->addWidget(opacityBox,0, 1) ;
    centerLayout->addWidget(settingsBox, 1, 1) ;

    setWindowTitle("Corals") ;
    center->setLayout(centerLayout) ;
    setCentralWidget(center) ;
}
コード例 #13
0
ファイル: mainwindow.cpp プロジェクト: hkutangyu/QTDemo
MainWindow::MainWindow(const QString &factoryTable, const QString &carTable,
                       QFile *carDetails, QWidget *parent)
     : QMainWindow(parent)
{
    file = carDetails;
    readCarData();

    carModel = new QSqlRelationalTableModel(this);
    carModel->setTable(carTable);
// 		carModel->select();
    carModel->setRelation(2, QSqlRelation(factoryTable, "id", "manufactory"));
    carModel->select();
	
    factoryModel = new QSqlTableModel(this);
    factoryModel->setTable(factoryTable);
    factoryModel->select();
    
    QGroupBox *factory = createFactoryGroupBox();
    QGroupBox *cars = createCarGroupBox();
    QGroupBox *details = createDetailsGroupBox();

    uniqueCarId = carModel->rowCount();
    uniqueFactoryId = factoryModel->rowCount();

    QGridLayout *layout = new QGridLayout;
    layout->addWidget(factory, 0, 0);
    layout->addWidget(cars, 1, 0);
    layout->addWidget(details, 0, 1, 2, 1);
    layout->setColumnStretch(1, 1);
    layout->setColumnMinimumWidth(0, 500);

    QWidget *widget = new QWidget;
    widget->setLayout(layout);
    setCentralWidget(widget);
    createMenuBar();

    resize(850, 400);
    setWindowTitle(tr("主从视图"));
}
コード例 #14
0
CStatusWidget::CStatusWidget(CStatusPrinter* _statusPrinter)
{
    statusPrinter = _statusPrinter;
    logTime.start();
    this->setAllowedAreas(Qt::BottomDockWidgetArea);
    this->setFeatures(QDockWidget::NoDockWidgetFeatures);
    statusText = new QTextEdit(this);
    titleLbl = new QLabel(tr("Messages"));
    statusText->setMaximumWidth(1000);
    QWidget* w = new QWidget(this);
    statusText->setFixedSize(600, 200);
    QGridLayout* layout = new QGridLayout(w);
    layout->addWidget(statusText, 0, 0);
    layout->setAlignment(statusText, Qt::AlignLeft);
    layout->setColumnMinimumWidth(0, 500);
    statusText->resize(1000, 200);
    w->setLayout(layout);
    this->setSizeIncrement(this->width(), 100);
    statusText->setReadOnly(true);

//    this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    this->setWidget(w);
}
コード例 #15
0
CheapestPathDialog::CheapestPathDialog(QWidget *parent) :
  QDialog(parent)
{
  QLabel *labelStartNode = new QLabel(tr("Start node: "));
  QLabel *labelEndNode = new QLabel(tr("End node: "));
  QLineEdit *leStartNode = new QLineEdit(start);
  QLineEdit *leEndNode = new QLineEdit(end);
  QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
  QGridLayout *ctDialogLayout = new QGridLayout(dynamic_cast<QWidget*>(this));

  ctDialogLayout->addWidget(dynamic_cast<QWidget*>(labelStartNode), 0, 0);
  ctDialogLayout->addWidget(dynamic_cast<QWidget*>(labelEndNode), 1, 0);
  ctDialogLayout->addWidget(dynamic_cast<QWidget*>(leStartNode), 0, 1);
  ctDialogLayout->addWidget(dynamic_cast<QWidget*>(leEndNode), 1, 1);
  ctDialogLayout->addWidget(dynamic_cast<QWidget*>(buttonBox), 2, 1);
  ctDialogLayout->setColumnStretch(1, 1);
  ctDialogLayout->setColumnMinimumWidth(1, 250);
  connect(buttonBox, SIGNAL(accepted()), this, SLOT(run()));
  connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
  
  setWindowTitle("Give start and end node");
  setLayout(ctDialogLayout);
}
コード例 #16
0
QWidget *DlgSettingsGridRemoval::createSubPanel ()
{
  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::createSubPanel";

  const int COLUMN_CHECKBOX_WIDTH = 60;

  QWidget *subPanel = new QWidget ();
  QGridLayout *layout = new QGridLayout (subPanel);
  subPanel->setLayout (layout);

  layout->setColumnStretch(0, 1); // Empty first column
  layout->setColumnStretch(1, 0); // Checkbox part of "section" checkboxes. In other rows this has empty space as indentation
  layout->setColumnMinimumWidth(1, COLUMN_CHECKBOX_WIDTH);
  layout->setColumnStretch(2, 0); // X
  layout->setColumnStretch(3, 0); // Y
  layout->setColumnStretch(4, 1); // Empty last column

  int row = 0;
  createRemoveGridLines (layout, row);
  createPreview (layout, row);

  return subPanel;
}
コード例 #17
0
ファイル: problemdialog.cpp プロジェクト: karban/field
QWidget *ProblemWidget::createControlsGeneral()
{
    // problem
    txtName = new QLineEdit("");

    // fill combobox
    fillComboBox();

    // general
    QGridLayout *layoutGeneral = new QGridLayout();
    layoutGeneral->setColumnMinimumWidth(0, minWidth);
    layoutGeneral->setColumnStretch(1, 1);
    layoutGeneral->addWidget(new QLabel(tr("Linear solver:")), 1, 0);

    QGroupBox *grpGeneral = new QGroupBox(tr("General"));
    grpGeneral->setLayout(layoutGeneral);

    // both
    QVBoxLayout *layoutPanel = new QVBoxLayout();
    layoutPanel->addWidget(grpGeneral);
    layoutPanel->addStretch();

    // name
    QGridLayout *layoutName = new QGridLayout();
    layoutName->addWidget(new QLabel(tr("Name:")), 0, 0);
    layoutName->addWidget(txtName, 0, 1);

    QVBoxLayout *layoutProblem = new QVBoxLayout();
    layoutProblem->addLayout(layoutName);
    layoutProblem->addLayout(layoutPanel);
    layoutProblem->addStretch();

    QWidget *widMain = new QWidget();
    widMain->setLayout(layoutProblem);

    return widMain;
}
コード例 #18
0
void NavigationWidget::addDocumentationData(bool finished)
{
    kDebug() << "Done loading!";
    disconnect(m_documentationWebView, SIGNAL(loadFinished(bool)));
    if ( finished ) {
        QGridLayout* newLayout = new QGridLayout();
        newLayout->setRowMinimumHeight(0, 200);
        newLayout->setColumnMinimumWidth(0, 500);
        newLayout->addWidget(m_documentationWebView);
        layout()->addItem(newLayout);
    }
    else {
        kError() << "Failed to get documentation for " << m_fullyQualifiedModuleIdentifier;
    }
//     QWebElement document = m_documentationWebView->page()->mainFrame()->documentElement();
//     if ( ! document.isNull() ) {
//         kDebug() << " >>> Trying to append documentation... ";
//         kDebug() << document.findFirst("body").tagName();
//         document.findFirst("body").findFirst("div").replace(m_originalHtml);
//     }
//     else {
//         kError() << " !!! Could not append documentation to HTML page received!";
//     }
}
コード例 #19
0
ファイル: EqControlsDialog.cpp プロジェクト: BaraMGB/lmms
EqControlsDialog::EqControlsDialog( EqControls *controls ) :
	EffectControlDialog( controls ),
	m_controls( controls )
{
	setAutoFillBackground( true );
	QPalette pal;
	pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "EqLayout1BG" ) );
	setPalette( pal );
	setFixedSize( 500, 500 );
	QGridLayout *mainLayout = new QGridLayout( this );

	EqSpectrumView *inSpec = new EqSpectrumView( &controls->m_inFftBands, this );
	mainLayout->addWidget( inSpec, 0, 1, 1, 8 );
	inSpec->setColor( QColor( 238, 154, 120, 80 ) );

	EqSpectrumView *outSpec = new EqSpectrumView( &controls->m_outFftBands, this );
	outSpec->setColor( QColor( 145, 205, 22, 80 ) );
	mainLayout->addWidget( outSpec, 0, 1, 1, 8 );

	m_parameterWidget = new EqParameterWidget( this , controls );
	mainLayout->addWidget( m_parameterWidget, 0, 1, 1, 8 );

	setBand( 0, &controls->m_hpActiveModel, &controls->m_hpFeqModel, &controls->m_hpResModel, 0, QColor(255 ,255, 255), tr( "HP" ) ,0,0, &controls->m_hp12Model, &controls->m_hp24Model, &controls->m_hp48Model,0,0,0);
	setBand( 1, &controls->m_lowShelfActiveModel, &controls->m_lowShelfFreqModel, &controls->m_lowShelfResModel, &controls->m_lowShelfGainModel, QColor(255 ,255, 255), tr( "Low Shelf" ), &controls->m_lowShelfPeakL , &controls->m_lowShelfPeakR,0,0,0,0,0,0 );
	setBand( 2, &controls->m_para1ActiveModel, &controls->m_para1FreqModel, &controls->m_para1BwModel, &controls->m_para1GainModel, QColor(255 ,255, 255), tr( "Peak 1" ), &controls->m_para1PeakL, &controls->m_para1PeakR,0,0,0,0,0,0 );
	setBand( 3, &controls->m_para2ActiveModel, &controls->m_para2FreqModel, &controls->m_para2BwModel, &controls->m_para2GainModel, QColor(255 ,255, 255), tr( "Peak 2" ), &controls->m_para2PeakL, &controls->m_para2PeakR,0,0,0,0,0,0 );
	setBand( 4, &controls->m_para3ActiveModel, &controls->m_para3FreqModel, &controls->m_para3BwModel, &controls->m_para3GainModel, QColor(255 ,255, 255), tr( "Peak 3" ), &controls->m_para3PeakL, &controls->m_para3PeakR,0,0,0,0,0,0 );
	setBand( 5, &controls->m_para4ActiveModel, &controls->m_para4FreqModel, &controls->m_para4BwModel, &controls->m_para4GainModel, QColor(255 ,255, 255), tr( "Peak 4" ), &controls->m_para4PeakL, &controls->m_para4PeakR,0,0,0,0,0,0 );
	setBand( 6, &controls->m_highShelfActiveModel, &controls->m_highShelfFreqModel, &controls->m_highShelfResModel, &controls->m_highShelfGainModel, QColor(255 ,255, 255), tr( "High Shelf" ), &controls->m_highShelfPeakL, &controls->m_highShelfPeakR,0,0,0,0,0,0 );
	setBand( 7, &controls->m_lpActiveModel, &controls->m_lpFreqModel, &controls->m_lpResModel, 0, QColor(255 ,255, 255), tr( "LP" ) ,0,0,0,0,0, &controls->m_lp12Model, &controls->m_lp24Model, &controls->m_lp48Model);

	EqFader *inGainFader = new EqFader( &controls->m_inGainModel, tr( "In Gain" ), this, &controls->m_inPeakL, &controls->m_inPeakR );
	mainLayout->addWidget( inGainFader, 0, 0 );
	inGainFader->setDisplayConversion( false );
	inGainFader->setHintText( tr( "Gain" ), "dBFS");

	EqFader *outGainFader = new EqFader( &controls->m_outGainModel, tr( "Out Gain" ), this, &controls->m_outPeakL, &controls->m_outPeakR );
	mainLayout->addWidget( outGainFader, 0, 9 );
	outGainFader->setDisplayConversion( false );
	outGainFader->setHintText( tr( "Gain" ), "dBFS" );

	// Gain Fader for each Filter exepts the pass filter
	for( int i = 1; i < m_parameterWidget->bandCount() - 1; i++ )
	{
		EqFader *gainFader = new EqFader( m_parameterWidget->getBandModels( i )->gain, tr( "" ), this,
								   m_parameterWidget->getBandModels( i )->peakL, m_parameterWidget->getBandModels( i )->peakR );
		mainLayout->addWidget( gainFader, 2, i+1 );
		mainLayout->setAlignment( gainFader, Qt::AlignHCenter );
		gainFader->setMinimumHeight(80);
		gainFader->resize(gainFader->width() , 80);
		gainFader->setDisplayConversion( false );
		gainFader->setHintText( tr( "Gain") , "dB");
	}
	
	//Control Button and Knobs for each Band
	for( int i = 0; i < m_parameterWidget->bandCount() ; i++ )
	{
		Knob *resKnob = new Knob( knobBright_26, this );
		mainLayout->setRowMinimumHeight( 4, 33 );
		mainLayout->addWidget( resKnob, 5, i + 1 );
		mainLayout->setAlignment( resKnob, Qt::AlignHCenter );
		resKnob->setVolumeKnob(false);
		resKnob->setModel( m_parameterWidget->getBandModels( i )->res );
		if(i > 1 && i < 6) { resKnob->setHintText( tr( "Bandwidth: " ) , tr( " Octave" ) ); }
		else { resKnob->setHintText( tr( "Resonance : " ) , "" ); }

		Knob *freqKnob = new Knob( knobBright_26, this );
		mainLayout->addWidget( freqKnob, 3, i+1 );
		mainLayout->setAlignment( freqKnob, Qt::AlignHCenter );
		freqKnob->setVolumeKnob( false );
		freqKnob->setModel( m_parameterWidget->getBandModels( i )->freq );
		freqKnob->setHintText( tr( "Frequency:" ), "Hz" );

		// adds the Number Active buttons
		PixmapButton *activeNumButton = new PixmapButton( this, NULL );
		activeNumButton->setCheckable(true);
		activeNumButton->setModel( m_parameterWidget->getBandModels( i )->active );
		QString iconActiveFileName = "bandLabel" + QString::number(i+1) + "on";
		QString iconInactiveFileName = "bandLabel" + QString::number(i+1);
		activeNumButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( iconActiveFileName.toLatin1() ) );
		activeNumButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( iconInactiveFileName.toLatin1() ) );
		mainLayout->addWidget( activeNumButton, 1, i+1 );
		mainLayout->setAlignment( activeNumButton, Qt::AlignHCenter );
		activeNumButton->setModel( m_parameterWidget->getBandModels( i )->active );

		// adds the symbols active buttons
		PixmapButton *activeButton = new PixmapButton( this, NULL );
		activeButton->setCheckable(true);
		activeButton->setModel( m_parameterWidget->getBandModels( i )->active );
		switch (i)
		{
		case 0:
			activeButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "ActiveHP" ) );
			activeButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "ActiveHPoff" ) );
			break;
		case 1:
			activeButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "ActiveLS" ) );
			activeButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "ActiveLSoff" ) );
			break;
		case 6:
			activeButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "ActiveHS" ) );
			activeButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "ActiveHSoff" ) );
			break;
		case 7:
			activeButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "ActiveLP" ) );
			activeButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "ActiveLPoff" ) );
			break;
		default:
			activeButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "ActivePeak" ) );
			activeButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "ActivePeakoff" ) );
		}

		mainLayout->addWidget( activeButton, 7, i+1 );
		mainLayout->setAlignment( activeButton, Qt::AlignHCenter);
		activeButton->setModel( m_parameterWidget->getBandModels( i )->active );

		// Connects the knobs, Faders and buttons with the curve graphic
		QObject::connect( m_parameterWidget->getBandModels( i )->freq , SIGNAL( dataChanged() ), m_parameterWidget, SLOT ( updateHandle() ) );
		if ( m_parameterWidget->getBandModels( i )->gain ) QObject::connect( m_parameterWidget->getBandModels( i )->gain, SIGNAL( dataChanged() ), m_parameterWidget, SLOT ( updateHandle() ));
		QObject::connect( m_parameterWidget->getBandModels( i )->res, SIGNAL( dataChanged() ), m_parameterWidget , SLOT ( updateHandle() ) );
		QObject::connect( m_parameterWidget->getBandModels( i )->active, SIGNAL( dataChanged() ), m_parameterWidget , SLOT ( updateHandle() ) );

		m_parameterWidget->changeHandle( i );
	}

	// adds the buttons for Spectrum analyser on/off
	PixmapButton *inSpecB = new PixmapButton(this, NULL);
	inSpecB->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "ActiveAnalyse" ) );
	inSpecB->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "ActiveAnalyseoff" ) );
	inSpecB->setCheckable( true );
	inSpecB->setModel( &controls->m_analyseInModel );

	PixmapButton *outSpecB = new PixmapButton(this, NULL);
	outSpecB->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "ActiveAnalyse" ) );
	outSpecB->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "ActiveAnalyseoff" ) );
	outSpecB->setCheckable( true );
	outSpecB->setModel( &controls->m_analyseOutModel );
	mainLayout->addWidget( inSpecB, 1, 0 );
	mainLayout->addWidget( outSpecB, 1, 9 );
	mainLayout->setAlignment( inSpecB, Qt::AlignHCenter );
	mainLayout->setAlignment( outSpecB, Qt::AlignHCenter );

	//hp filter type
	PixmapButton *hp12Button = new PixmapButton( this , NULL );
	hp12Button->setModel( m_parameterWidget->getBandModels( 0 )->hp12 );
	hp12Button->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "12dB" ) );
	hp12Button->setInactiveGraphic(  PLUGIN_NAME::getIconPixmap( "12dBoff" ) );

	PixmapButton *hp24Button = new PixmapButton( this , NULL );
	hp24Button->setModel(m_parameterWidget->getBandModels( 0 )->hp24 );
	hp24Button->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "24dB" ) );
	hp24Button->setInactiveGraphic(  PLUGIN_NAME::getIconPixmap( "24dBoff" ) );

	PixmapButton *hp48Button = new PixmapButton( this , NULL );
	hp48Button->setModel( m_parameterWidget->getBandModels(0)->hp48 );
	hp48Button->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "48dB" ) );
	hp48Button->setInactiveGraphic(  PLUGIN_NAME::getIconPixmap( "48dBoff" ) );

	//LP filter type
	PixmapButton *lp12Button = new PixmapButton( this , NULL );
	mainLayout->addWidget( lp12Button, 2, 1 );
	lp12Button->setModel( m_parameterWidget->getBandModels( 7 )->lp12 );
	lp12Button->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "12dB" ) );
	lp12Button->setInactiveGraphic(  PLUGIN_NAME::getIconPixmap( "12dBoff" ) );

	PixmapButton *lp24Button = new PixmapButton( this , NULL );
	lp24Button->setModel( m_parameterWidget->getBandModels( 7 )->lp24 );
	lp24Button->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "24dB" ) );
	lp24Button->setInactiveGraphic(  PLUGIN_NAME::getIconPixmap( "24dBoff" ) );

	PixmapButton *lp48Button = new PixmapButton( this , NULL );
	lp48Button->setModel( m_parameterWidget->getBandModels( 7 )->lp48 );
	lp48Button->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "48dB" ) );
	lp48Button->setInactiveGraphic(  PLUGIN_NAME::getIconPixmap( "48dBoff" ) );

	// the curve has to change its appearance
	connect( m_parameterWidget->getBandModels( 0 )->hp12 , SIGNAL ( dataChanged() ), m_parameterWidget, SLOT( updateHandle()));
	connect( m_parameterWidget->getBandModels( 0 )->hp24 , SIGNAL ( dataChanged() ), m_parameterWidget, SLOT( updateHandle()));
	connect( m_parameterWidget->getBandModels( 0 )->hp48 , SIGNAL ( dataChanged() ), m_parameterWidget, SLOT( updateHandle()));

	connect( m_parameterWidget->getBandModels( 7 )->lp12 , SIGNAL ( dataChanged() ), m_parameterWidget, SLOT( updateHandle()));
	connect( m_parameterWidget->getBandModels( 7 )->lp24 , SIGNAL ( dataChanged() ), m_parameterWidget, SLOT( updateHandle()));
	connect( m_parameterWidget->getBandModels( 7 )->lp48 , SIGNAL ( dataChanged() ), m_parameterWidget, SLOT( updateHandle()));

	QVBoxLayout *hpGrpBtnLayout = new QVBoxLayout;
	hpGrpBtnLayout->addWidget( hp12Button );
	hpGrpBtnLayout->addWidget( hp24Button );
	hpGrpBtnLayout->addWidget( hp48Button );

	QVBoxLayout *lpGrpBtnLayout = new QVBoxLayout;
	lpGrpBtnLayout->addWidget( lp12Button );
	lpGrpBtnLayout->addWidget( lp24Button );
	lpGrpBtnLayout->addWidget( lp48Button );

	mainLayout->addLayout( hpGrpBtnLayout, 2, 1,  Qt::AlignCenter );
	mainLayout->addLayout( lpGrpBtnLayout, 2, 8,  Qt::AlignCenter );

	automatableButtonGroup *lpBtnGrp = new automatableButtonGroup(this,tr ( "lp grp" ) );
	lpBtnGrp->addButton( lp12Button );
	lpBtnGrp->addButton( lp24Button );
	lpBtnGrp->addButton( lp48Button );
	lpBtnGrp->setModel( &m_controls->m_lpTypeModel, false);

	automatableButtonGroup *hpBtnGrp = new automatableButtonGroup( this, tr( "hp grp" ) );
	hpBtnGrp->addButton( hp12Button );
	hpBtnGrp->addButton( hp24Button );
	hpBtnGrp->addButton( hp48Button );
	hpBtnGrp->setModel( &m_controls->m_hpTypeModel,false);

	mainLayout->setAlignment( Qt::AlignTop );

	for (int i = 0 ; i < 10; i++)
	{
		mainLayout->setColumnMinimumWidth(i, 50);
	}

	mainLayout->setAlignment( inGainFader, Qt::AlignHCenter );
	mainLayout->setAlignment( outGainFader, Qt::AlignHCenter );
	mainLayout->setRowMinimumHeight( 0,200 );
	mainLayout->setRowMinimumHeight( 1, 40 );
	mainLayout->setRowMinimumHeight(6,15);
	mainLayout->setContentsMargins( 0, 11, 0, 0 );
	mainLayout->setAlignment(inSpec, Qt::AlignCenter );
	mainLayout->setAlignment(outSpec, Qt::AlignCenter );

	QLabel *freqLabel = new QLabel( this );
	freqLabel->setText("- " + tr( "Frequency")+ " -" );
	freqLabel->move( 217 , 377 );

	QLabel *resLabel1 = new QLabel( this );
	resLabel1->setText("- " + tr( "Resonance")+ " -" );
	resLabel1->move( 62 , 444 );

	QLabel *resLabel2 = new QLabel( this );
	resLabel2->setText("- " + tr( "Resonance")+ " -" );
	resLabel2->move( 365 , 444 );

	QLabel *bandWidthLabel = new QLabel( this );
	bandWidthLabel->setText("- " + tr( "Bandwidth")+ " -" );
	bandWidthLabel->move( 215 , 444 );

	setLayout(mainLayout);
}
コード例 #20
0
WaypointImpFilterDialog::WaypointImpFilterDialog( QWidget *parent ) :
    QDialog(parent),
    centerRef(CENTER_HOMESITE)
{
    setObjectName( "WaypointImpFilterDialog" );
    setWindowTitle(tr("Waypoint Filter"));
    setModal( true );

    save.usedFilter = WaypointCatalog::Radius;
    save.radiusIdxPosition = 6;
    save.radiusIdxHome = 6;
    save.radiusIdxMap = 6;
    save.radiusIdxAirfield = 6;
    save.airfieldRefIdx = 0;

    // create checkboxes
    useAll       = new QCheckBox(tr("Check/Uncheck all"));
    airfields    = new QCheckBox(tr("&Airfields"));
    gliderfields = new QCheckBox(tr("&Gliderfields"));
    outlandings  = new QCheckBox(tr("Ou&tlandings"));
    navaids      = new QCheckBox(tr("&Navaids"));
    obstacles    = new QCheckBox(tr("O&bstacles"));
    landmarks    = new QCheckBox(tr("&Landmarks"));
    hotspots     = new QCheckBox(tr("&Hotspots"));

    connect(useAll, SIGNAL(clicked()), this, SLOT(slotChangeUseAll()));

    QVBoxLayout *typeLayout = new QVBoxLayout;
    typeLayout->setSpacing( 10 );
    typeLayout->addWidget( useAll );
    typeLayout->addSpacing( 10 );
    typeLayout->addWidget( airfields );
    typeLayout->addWidget( gliderfields );
    typeLayout->addWidget( outlandings );
    typeLayout->addWidget( navaids );
    typeLayout->addWidget( obstacles );
    typeLayout->addWidget( landmarks );
    typeLayout->addWidget( hotspots );

    QGroupBox* typeGroup = new QGroupBox( tr("Type") );
    typeGroup->setLayout( typeLayout );

    //---------------------------------------------------------------------------
    rbf0 = new QRadioButton(tr("Radius"));
    rbf1 = new QRadioButton(tr("Area"));

    QButtonGroup* filterButtonGroup = new QButtonGroup(this);
    filterButtonGroup->setExclusive(true);
    filterButtonGroup->addButton( rbf0, WaypointCatalog::Radius );
    filterButtonGroup->addButton( rbf1, WaypointCatalog::Area );

    connect( filterButtonGroup, SIGNAL( buttonClicked(int)),
             this, SLOT(slotFilterChanged(int)) );

    QHBoxLayout* filterBox = new QHBoxLayout;
    filterBox->addWidget( rbf0 );
    filterBox->addSpacing( 10 );
    filterBox->addWidget( rbf1 );
    filterBox->addStretch( 10 );

    filterGroup = new QGroupBox( tr("Filter") );
    filterGroup->setLayout( filterBox );

    //---------------------------------------------------------------------------
    fromLat  = new LatEdit;
    fromLong = new LongEdit;

    QGridLayout* fromGrid = new QGridLayout;
    fromGrid->setSpacing( 10 );
    fromGrid->addWidget( new QLabel(tr("Lat:")), 0 , 0 );
    fromGrid->addWidget( fromLat, 0, 1 );
    fromGrid->setColumnMinimumWidth( 2, 10 );
    fromGrid->addWidget( new QLabel(tr("Lon:")), 0 , 3 );
    fromGrid->addWidget( fromLong, 0, 4 );
    fromGrid->setColumnStretch( 5, 10 );

    fromGroup = new QGroupBox( tr("Area From") );
    fromGroup->setLayout( fromGrid );

    //---------------------------------------------------------------------------
    toLat  = new LatEdit;
    toLong = new LongEdit;

    QGridLayout* toGrid = new QGridLayout;
    toGrid->setSpacing( 10 );
    toGrid->addWidget( new QLabel(tr("Lat:")), 0 , 0 );
    toGrid->addWidget( toLat, 0, 1 );
    toGrid->setColumnMinimumWidth( 2, 10 );
    toGrid->addWidget( new QLabel(tr("Lon:")), 0 , 3 );
    toGrid->addWidget( toLong, 0, 4 );
    toGrid->setColumnStretch( 5, 10 );

    toGroup = new QGroupBox( tr("Area to") );
    toGroup->setLayout( toGrid );

    //---------------------------------------------------------------------------
    rb0 = new QRadioButton(tr("Position"));
    rb1 = new QRadioButton(tr("Homesite"));
    rb2 = new QRadioButton(tr("Center of Map"));
    rb3 = new QRadioButton(tr("Airfield"));

    QButtonGroup* radiusButtonGroup = new QButtonGroup(this);
    radiusButtonGroup->setExclusive(true);
    radiusButtonGroup->addButton( rb0, CENTER_POS );
    radiusButtonGroup->addButton( rb1, CENTER_HOMESITE );
    radiusButtonGroup->addButton( rb2, CENTER_MAP );
    radiusButtonGroup->addButton( rb3, CENTER_AIRFIELD );

    connect( radiusButtonGroup, SIGNAL( buttonClicked(int)),
             this, SLOT(selectRadius(int)) );

    centerLat  = new LatEdit;
    centerLong = new LongEdit;
    airfieldRefBox = new QComboBox;
    radiusUnit = new QLabel;

    connect( airfieldRefBox, SIGNAL(currentIndexChanged(const QString&)),
             this, SLOT(slotAirfieldRefChanged(const QString&)) );

    radius = new QComboBox;
    radius->setEditable( true );
    radius->setValidator( new QIntValidator(1, 10000, this) );
    QStringList itemList;
    itemList << tr("Off") << "10" << "25" << "50" << "100" << "250" << "500"
             << "750" << "1000" << "1500" << "2000";
    radius->addItems( itemList );
    radius->setCurrentIndex( 5 );

    connect( radius, SIGNAL(currentIndexChanged(int)), SLOT(slotRadiusChanged(int)) );

    QGridLayout *radiusGrid = new QGridLayout;
    radiusGrid->setSpacing(10);
    radiusGrid->addWidget( rb0, 0, 0 );
    radiusGrid->addWidget( new QLabel(tr("Lat:")), 0, 1 );
    radiusGrid->addWidget( centerLat, 0, 2);
    radiusGrid->addWidget( new QLabel(tr("Lon:")), 0, 3 );
    radiusGrid->addWidget( centerLong, 0, 4 );

    radiusGrid->addWidget( rb1, 1, 0 );
    radiusGrid->addWidget( rb2, 2, 0 );
    radiusGrid->addWidget( rb3, 3, 0 );
    radiusGrid->addWidget( airfieldRefBox, 3, 2 );

    radiusGrid->addWidget( radiusUnit, 4, 0 );
    radiusGrid->addWidget( radius, 4, 2 );
    radiusGrid->setColumnStretch( 5, 10 );

    radiusGroup = new QGroupBox( tr("Radius") );
    radiusGroup->setLayout( radiusGrid );

    //---------------------------------------------------------------------------
    QHBoxLayout *buttonBox = new QHBoxLayout;

    QPushButton *b = new QPushButton(tr("&Clear"), this);
    connect(b, SIGNAL(clicked()), this, SLOT(slotClear()));
    buttonBox->addWidget(b);
    buttonBox->addStretch( 10 );

    b = new QPushButton(tr("&Ok"), this);
    b->setDefault(true);
    connect(b, SIGNAL(clicked()), this, SLOT(slotOk()));
    buttonBox->addWidget(b);

    b = new QPushButton(tr("&Cancel"), this);
    connect(b, SIGNAL(clicked()), this, SLOT(slotCancel()));
    buttonBox->addWidget(b);

    //---------------------------------------------------------------------------
    QVBoxLayout *ftrBox = new QVBoxLayout;
    ftrBox->addWidget( filterGroup );
    ftrBox->addWidget( fromGroup );
    ftrBox->addWidget( toGroup );
    ftrBox->addWidget( radiusGroup );
    ftrBox->addStretch( 10 );

    QHBoxLayout *hBox = new QHBoxLayout;
    hBox->addWidget( typeGroup );
    hBox->addLayout( ftrBox );

    QVBoxLayout *top = new QVBoxLayout;
    top->addLayout( hBox );
    top->addLayout( buttonBox );

    setLayout( top );

    slotClear();
    slotChangeUseAll();
    selectRadius(CENTER_HOMESITE);
    loadRadiusValue();
}
コード例 #21
0
ファイル: hw1viewer.cpp プロジェクト: joshkillinger/graphics
//
//  Constructor
//
Hw1viewer::Hw1viewer()
{
    //  Set window title
    setWindowTitle(tr("Assignment 1: Josh Killinger"));

    //  Create new OpenGL widget
    Hw1opengl* hw1opengl = new Hw1opengl(this);

    //  Select shader
    QComboBox* shader = new QComboBox();
    shader->addItem("None");
    shader->addItem("Basic");
    shader->addItem("NDC to RGB");

    //  Select projection
    QComboBox* projection = new QComboBox();
    projection->addItem("Orthogonal");
    projection->addItem("Perspective");

    //  Select object
    QComboBox* object = new QComboBox();
    object->addItem("Cube");
    object->addItem("Teapot");
    object->addItem("Tyra");

    //  Lighting
    QCheckBox* lighting = new QCheckBox("");

    //  View angle
    QLabel* angles = new QLabel();

    //  Position Sliders
    xSlider = new QSlider(Qt::Horizontal);
    ySlider = new QSlider(Qt::Horizontal);
    zSlider = new QSlider(Qt::Horizontal);
    xSlider->setRange(-2000, 2000);
    ySlider->setRange(-2000, 2000);
    zSlider->setRange(-2000, 2000);
    xSlider->setTracking(true);
    ySlider->setTracking(true);
    zSlider->setTracking(true);
    xSlider->setValue(0);
    ySlider->setValue(0);
    zSlider->setValue(0);

    //  Quit
    QPushButton* quit = new QPushButton("Quit");

    //  Set layout of child widgets
    QGridLayout* layout = new QGridLayout;
    layout->addWidget(hw1opengl,0,0,10,1);
    layout->addWidget(new QLabel("Shader"),0,1);
    layout->addWidget(shader,0,2);
    layout->addWidget(new QLabel("Projection"),1,1);
    layout->addWidget(projection,1,2);
    layout->addWidget(new QLabel("Object"),2,1);
    layout->addWidget(object,2,2);
    layout->addWidget(new QLabel("Lighting"),3,1);
    layout->addWidget(lighting,3,2);
    layout->addWidget(new QLabel("X Pos"),4,1);
    layout->addWidget(xSlider,4,2);
    layout->addWidget(new QLabel("Y Pos"),5,1);
    layout->addWidget(ySlider,5,2);
    layout->addWidget(new QLabel("Z Pos"),6,1);
    layout->addWidget(zSlider,6,2);
    layout->addWidget(new QLabel("Angles"),7,1);
    layout->addWidget(angles,7,2);
    layout->addWidget(quit,9,2);
    //  Manage resizing
    layout->setColumnStretch(0,100);
    layout->setColumnMinimumWidth(0,100);
    layout->setRowStretch(8,100);
    setLayout(layout);

    //  Connect valueChanged() signals to ex01opengl
    connect(shader,SIGNAL(currentIndexChanged(int))      , hw1opengl, SLOT(setShader(int)));
    connect(object,SIGNAL(currentIndexChanged(int))      , hw1opengl, SLOT(setObject(int)));
    connect(projection,SIGNAL(currentIndexChanged(int))  , hw1opengl, SLOT(setPerspective(int)));
    connect(lighting,SIGNAL(stateChanged(int))           , hw1opengl, SLOT(setLighting(int)));
    connect(xSlider,SIGNAL(valueChanged(int))            , hw1opengl, SLOT(setXPos(int)));
    connect(ySlider,SIGNAL(valueChanged(int))            , hw1opengl, SLOT(setYPos(int)));
    connect(zSlider,SIGNAL(valueChanged(int))            , hw1opengl, SLOT(setZPos(int)));

    //  Connect angles() signal to label
    connect(hw1opengl,SIGNAL(angles(QString)) , angles,SLOT(setText(QString)));
    //  Connect quit() signal to qApp::quit()
    connect(quit,SIGNAL(pressed()) , qApp,SLOT(quit()));
}
コード例 #22
0
/*
 * Initialize the GUI interface for the plugin - this is only called once when the plugin is
 * added to the plugin registry in the QGIS application.
 */
void CoordinateCapture::initGui()
{
    mCrs.createFromSrsId( GEOCRS_ID );	// initialize the CRS object

    connect( mQGisIface->mapCanvas()->mapRenderer(), SIGNAL( destinationSrsChanged() ), this, SLOT( setSourceCrs() ) );

    setSourceCrs();	//set up the source CRS
    mTransform.setDestCRS( mCrs );	// set the CRS in the transform
    mUserCrsDisplayPrecision = ( mCrs.mapUnits() == QGis::Degrees ) ? 8 : 3;	// precision depends on CRS units

    // Create the action for tool
    mQActionPointer = new QAction( QIcon( ":/coordinatecapture/coordinate_capture.png" ), tr( "Coordinate Capture" ), this );
    // Set the what's this text
    mQActionPointer->setWhatsThis( tr( "Click on the map to view coordinates and capture to clipboard." ) );
    // Connect the action to the run
    connect( mQActionPointer, SIGNAL( triggered() ), this, SLOT( run() ) );
    // Add the icon to the toolbar
    mQGisIface->addToolBarIcon( mQActionPointer );
    mQGisIface->addPluginToMenu( tr( "&Coordinate Capture" ), mQActionPointer );

    // create our map tool
    mpMapTool = new CoordinateCaptureMapTool( mQGisIface->mapCanvas() );
    connect( mpMapTool, SIGNAL( mouseMoved( QgsPoint ) ), this, SLOT( mouseMoved( QgsPoint ) ) );
    connect( mpMapTool, SIGNAL( mouseClicked( QgsPoint ) ), this, SLOT( mouseClicked( QgsPoint ) ) );


    // create a little widget with x and y display to put into our dock widget
    QWidget * mypWidget = new QWidget();
    QGridLayout *mypLayout = new QGridLayout( mypWidget );
    mypLayout->setColumnMinimumWidth( 0, 36 );
    mypWidget->setLayout( mypLayout );

    QToolButton * mypUserCrsToolButton = new QToolButton( mypWidget );
    mypUserCrsToolButton->setIcon( QIcon( ":/coordinatecapture/geographic.png" ) );
    mypUserCrsToolButton->setToolTip( tr( "Click to select the CRS to use for coordinate display" ) );
    connect( mypUserCrsToolButton, SIGNAL( clicked() ), this, SLOT( setCRS() ) );

    QLabel * mypCRSLabel = new QLabel( mypWidget );
    mypCRSLabel->setPixmap( QPixmap( ":/coordinatecapture/transformed.png" ) );
    mypCRSLabel->setGeometry( mypUserCrsToolButton->geometry() );

    mpUserCrsEdit = new QLineEdit( mypWidget );
    mpUserCrsEdit->setReadOnly( true );
    mpUserCrsEdit->setToolTip( tr( "Coordinate in your selected CRS" ) );

    mpCanvasEdit = new QLineEdit( mypWidget );
    mpCanvasEdit->setReadOnly( true );
    mpCanvasEdit->setToolTip( tr( "Coordinate in map canvas coordinate reference system" ) );

    QPushButton * mypCopyButton = new QPushButton( mypWidget );
    mypCopyButton->setText( tr( "Copy to clipboard" ) );
    connect( mypCopyButton, SIGNAL( clicked() ), this, SLOT( copy() ) );

    mpTrackMouseButton = new QToolButton( mypWidget );
    mpTrackMouseButton->setCheckable( true );
    mpTrackMouseButton->setToolTip( tr( "Click to enable mouse tracking. Click the canvas to stop" ) );
    mpTrackMouseButton->setChecked( false );
    mpTrackMouseButton->setIcon( QIcon( ":/coordinatecapture/tracking.png" ) );

    mypLayout->addWidget( mypUserCrsToolButton, 0, 0 );
    mypLayout->addWidget( mpUserCrsEdit, 0, 1 );
    mypLayout->addWidget( mypCRSLabel, 1, 0 );
    mypLayout->addWidget( mpCanvasEdit, 1, 1 );
    mypLayout->addWidget( mpTrackMouseButton, 2, 0 );
    mypLayout->addWidget( mypCopyButton, 2, 1 );


    //create the dock widget
    mpDockWidget = new QDockWidget( tr( "Coordinate Capture" ), mQGisIface->mainWindow() );
    mpDockWidget->setObjectName( "CoordinateCapture" );
    mpDockWidget->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
    mQGisIface->addDockWidget( Qt::LeftDockWidgetArea, mpDockWidget );

    // now add our custom widget to the dock - ownership of the widget is passed to the dock
    mpDockWidget->setWidget( mypWidget );

}
コード例 #23
0
ファイル: numberInputPad.cpp プロジェクト: Exadios/Cumulus
/**
 * Constructor
 */
NumberInputPad::NumberInputPad( QString number, QWidget *parent ) :
  QFrame( parent ),
  m_autoSip(true),
  m_setNumber(number),
  m_intMaximum(false, INT_MAX),
  m_intMinimum(false, INT_MIN),
  m_doubleMaximum(false, 0.0),
  m_doubleMinimum(false, 0.0),
  m_pressedButton( 0 )
{
#ifdef ANDROID
  setFrameStyle(QFrame::Box | QFrame::Plain);
#else
  setFrameStyle( QFrame::StyledPanel | QFrame::Plain );
#endif

  setLineWidth( 3 * Layout::getIntScaledDensity() );

  QPalette palette;
  palette.setColor(QPalette::WindowText, Qt::darkBlue);
  setPalette(palette);

  setObjectName("NumberInputPad");
  setWindowFlags(Qt::Tool);
  setWindowModality( Qt::WindowModal );
  setAttribute(Qt::WA_DeleteOnClose);

  // Save the current state of the software input panel
  m_autoSip = qApp->autoSipEnabled();

  // Disable software input panel
  qApp->setAutoSipEnabled( false );

  int row = 0;
  QGridLayout* gl = new QGridLayout (this);
  gl->setMargin( 5 * Layout::getIntScaledDensity() );
  gl->setSpacing( 10 * Layout::getIntScaledDensity() );

  m_tipLabel = new QLabel (this);
  m_tipLabel->setAlignment(Qt::AlignCenter);
  gl->addWidget( m_tipLabel, row, 0, 1, 5 );

  gl->setRowStretch(row, 5 * Layout::getIntScaledDensity() );
  row++;

  m_editor = new QLineEdit (this);

  connect( m_editor, SIGNAL(textChanged(const QString&)),
           this, SLOT(slot_TextChanged(const QString&)) );

  setNumber( number );
  gl->addWidget( m_editor, row, 0, 1, 5 );

  int iconSize = Layout::iconSize( font() );
  QSize qis( iconSize, iconSize );

  int minBW = QFontMetrics(font()).width("MMM");

  m_cancel = new QPushButton( " ", this );
  m_cancel->setIcon( QIcon(GeneralConfig::instance()->loadPixmap("cancel.png")) );
  m_cancel->setIconSize( qis );
  m_cancel->setMinimumWidth( minBW );
  gl->addWidget( m_cancel, row, 6 );
  row++;

  gl->setRowMinimumHeight( row, 5 * Layout::getIntScaledDensity() );
  gl->setColumnMinimumWidth( 5, 5 * Layout::getIntScaledDensity());
  row++;

  m_num1 = new QPushButton( " 1 ", this );
  m_num1->setMinimumWidth( minBW );
  gl->addWidget( m_num1, row, 0 );

  m_num2 = new QPushButton( " 2 ", this );
  m_num2->setMinimumWidth( minBW );
  gl->addWidget( m_num2, row, 1 );

  m_num3 = new QPushButton( " 3 ", this );
  m_num3->setMinimumWidth( minBW );
  gl->addWidget( m_num3, row, 2 );

  m_num4 = new QPushButton( " 4 ", this );
  m_num4->setMinimumWidth( minBW );
  gl->addWidget( m_num4, row, 3 );

  m_num5 = new QPushButton( " 5 ", this );
  m_num5->setMinimumWidth( minBW );
  gl->addWidget( m_num5, row, 4 );

  m_home = new QPushButton( " ", this );
  m_home->setMinimumWidth( minBW );
  m_home->setIcon( QIcon(GeneralConfig::instance()->loadPixmap("home_new.png")) );
  m_home->setIconSize( qis );
  gl->addWidget( m_home, row, 6 );
  row++;

  m_num6 = new QPushButton( " 6 ", this );
  m_num6->setMinimumWidth( minBW );
  gl->addWidget( m_num6, row, 0 );

  m_num7 = new QPushButton( " 7 ", this );
  m_num7->setMinimumWidth( minBW );
  gl->addWidget( m_num7, row, 1 );

  m_num8 = new QPushButton( " 8 ", this );
  m_num8->setMinimumWidth( minBW );
  gl->addWidget( m_num8, row, 2 );

  m_num9 = new QPushButton( " 9 ", this );
  m_num9->setMinimumWidth( minBW );
  gl->addWidget( m_num9, row, 3 );

  m_num0 = new QPushButton( " 0 ", this );
  m_num0->setMinimumWidth( minBW );
  gl->addWidget( m_num0, row, 4 );

  m_pm = new QPushButton( "+ -", this );
  m_pm->setMinimumWidth( minBW );
  gl->addWidget( m_pm, row, 6 );

  row++;

  m_decimal = new QPushButton( " . ", this );
  m_decimal->setMinimumWidth( minBW );
  gl->addWidget( m_decimal, row, 0 );

  QStyle* style = QApplication::style();

  m_left = new QPushButton( " ", this);
  m_left->setMinimumWidth( minBW );
  //m_left->setIcon(style->standardIcon(QStyle::SP_ArrowLeft));
  m_left->setIcon( QIcon(GeneralConfig::instance()->loadPixmap("left-32.png")) );
  m_left->setIconSize( qis );
  gl->addWidget( m_left, row, 1 );

  m_right = new QPushButton( " ", this );
  m_right->setMinimumWidth( minBW );
  //m_right->setIcon(style->standardIcon(QStyle::SP_ArrowRight));
  m_right->setIcon( QIcon(GeneralConfig::instance()->loadPixmap("right-32.png")) );
  m_right->setIconSize( qis );
  gl->addWidget( m_right, row, 2 );

  m_delLeft = new QPushButton( " ", this );
  m_delLeft->setMinimumWidth( minBW );
  //m_delLeft->setIcon(style->standardIcon(QStyle::SP_MediaSkipBackward));
  m_delLeft->setIcon( QIcon(GeneralConfig::instance()->loadPixmap("media-skip-backward-32.png")) );
  m_delLeft->setIconSize( qis );
  gl->addWidget( m_delLeft, row, 3 );

  m_delRight = new QPushButton( " ", this );
  m_delRight->setMinimumWidth( minBW );
  //m_delRight->setIcon (style->standardIcon(QStyle::SP_MediaSkipForward));
  m_delRight->setIcon( QIcon(GeneralConfig::instance()->loadPixmap("media-skip-forward-32.png")) );
  m_delRight->setIconSize( qis );
  gl->addWidget( m_delRight, row, 4 );

  m_ok = new QPushButton( " ", this );
  m_ok->setMinimumWidth( minBW );
  m_ok->setIcon( QIcon(GeneralConfig::instance()->loadPixmap("ok.png")) );
  m_ok->setIconSize( qis );
  gl->addWidget( m_ok, row, 6 );

  m_ok->setFocusPolicy( Qt::NoFocus );
  m_cancel->setFocusPolicy( Qt::NoFocus );
  m_delLeft->setFocusPolicy( Qt::NoFocus );
  m_delRight->setFocusPolicy( Qt::NoFocus );
  m_left->setFocusPolicy( Qt::NoFocus );
  m_right->setFocusPolicy( Qt::NoFocus );
  m_decimal->setFocusPolicy( Qt::NoFocus );
  m_pm->setFocusPolicy( Qt::NoFocus );
  m_home->setFocusPolicy( Qt::NoFocus );
  m_num0->setFocusPolicy( Qt::NoFocus );
  m_num1->setFocusPolicy( Qt::NoFocus );
  m_num2->setFocusPolicy( Qt::NoFocus );
  m_num3->setFocusPolicy( Qt::NoFocus );
  m_num4->setFocusPolicy( Qt::NoFocus );
  m_num5->setFocusPolicy( Qt::NoFocus );
  m_num6->setFocusPolicy( Qt::NoFocus );
  m_num7->setFocusPolicy( Qt::NoFocus );
  m_num8->setFocusPolicy( Qt::NoFocus );
  m_num9->setFocusPolicy( Qt::NoFocus );

  m_digitSignalMapper = new QSignalMapper(this);
  m_buttonSignalMapper = new QSignalMapper(this);

  connect(m_num1, SIGNAL(pressed()), m_digitSignalMapper, SLOT(map()));
  connect(m_num2, SIGNAL(pressed()), m_digitSignalMapper, SLOT(map()));
  connect(m_num3, SIGNAL(pressed()), m_digitSignalMapper, SLOT(map()));
  connect(m_num4, SIGNAL(pressed()), m_digitSignalMapper, SLOT(map()));
  connect(m_num5, SIGNAL(pressed()), m_digitSignalMapper, SLOT(map()));
  connect(m_num6, SIGNAL(pressed()), m_digitSignalMapper, SLOT(map()));
  connect(m_num7, SIGNAL(pressed()), m_digitSignalMapper, SLOT(map()));
  connect(m_num8, SIGNAL(pressed()), m_digitSignalMapper, SLOT(map()));
  connect(m_num9, SIGNAL(pressed()), m_digitSignalMapper, SLOT(map()));
  connect(m_num0, SIGNAL(pressed()), m_digitSignalMapper, SLOT(map()));
  connect(m_decimal, SIGNAL(pressed()), m_buttonSignalMapper, SLOT(map()));
  connect(m_left, SIGNAL(pressed()), m_buttonSignalMapper, SLOT(map()));
  connect(m_right, SIGNAL(pressed()), m_buttonSignalMapper, SLOT(map()));
  connect(m_delLeft, SIGNAL(pressed()), m_buttonSignalMapper, SLOT(map()));
  connect(m_delRight, SIGNAL(pressed()), m_buttonSignalMapper, SLOT(map()));
  connect(m_home, SIGNAL(pressed()), m_buttonSignalMapper, SLOT(map()));

  m_digitSignalMapper->setMapping(m_num1, m_num1);
  m_digitSignalMapper->setMapping(m_num2, m_num2);
  m_digitSignalMapper->setMapping(m_num3, m_num3);
  m_digitSignalMapper->setMapping(m_num4, m_num4);
  m_digitSignalMapper->setMapping(m_num5, m_num5);
  m_digitSignalMapper->setMapping(m_num6, m_num6);
  m_digitSignalMapper->setMapping(m_num7, m_num7);
  m_digitSignalMapper->setMapping(m_num8, m_num8);
  m_digitSignalMapper->setMapping(m_num9, m_num9);
  m_digitSignalMapper->setMapping(m_num0, m_num0);
  m_buttonSignalMapper->setMapping(m_decimal, m_decimal);
  m_buttonSignalMapper->setMapping(m_left, m_left);
  m_buttonSignalMapper->setMapping(m_right, m_right);
  m_buttonSignalMapper->setMapping(m_delLeft, m_delLeft);
  m_buttonSignalMapper->setMapping(m_delRight, m_delRight);
  m_buttonSignalMapper->setMapping(m_home, m_home);

  connect( m_digitSignalMapper, SIGNAL(mapped(QWidget *)),
           this, SLOT(slot_DigitPressed(QWidget *)));
  connect( m_buttonSignalMapper, SIGNAL(mapped(QWidget *)),
           this, SLOT(slot_ButtonPressed(QWidget *)));

  connect( m_pm, SIGNAL(pressed() ), this, SLOT(slot_Pm()) );
  connect( m_ok, SIGNAL(pressed() ), this, SLOT(slot_Ok()) );
  connect( m_cancel, SIGNAL(pressed() ), this, SLOT(slot_Close()) );

  m_timerButton = new QTimer( this );
  m_timerButton->setSingleShot( true );
  m_timerDigit = new QTimer( this );
  m_timerDigit->setSingleShot( true );

  connect( m_timerButton, SIGNAL(timeout()), this, SLOT(slot_RepeatButton()));
  connect( m_timerDigit, SIGNAL(timeout()), this, SLOT(slot_RepeatDigit()));
}
コード例 #24
0
ファイル: ex01viewer.cpp プロジェクト: jchan1e/graphics
//
//  Constructor
//
Ex01viewer::Ex01viewer()
{
   //  Set window title
   setWindowTitle(tr("Ex01:  Basic Shader"));

   //  Create new OpenGL widget
   Ex01opengl* ex01opengl = new Ex01opengl;

   //  Select shader
   QComboBox* shader = new QComboBox();
   shader->addItem("None");
   shader->addItem("Basic");

   //  Select projection
   QComboBox* projection = new QComboBox();
   projection->addItem("Orthogonal");
   projection->addItem("Perspective");

   //  Select object
   QComboBox* object = new QComboBox();
   object->addItem("Cube");
   object->addItem("Teapot");
   object->addItem("Tyra");

   //  Lighting
   QCheckBox* lighting = new QCheckBox("");

   //  View angle
   QLabel* angles = new QLabel();

   //  Quit
   QPushButton* quit = new QPushButton("Quit");

   //  Set layout of child widgets
   QGridLayout* layout = new QGridLayout;
   layout->addWidget(ex01opengl,0,0,7,1);
   layout->addWidget(new QLabel("Shader"),0,1);
   layout->addWidget(shader,0,2);
   layout->addWidget(new QLabel("Projection"),1,1);
   layout->addWidget(projection,1,2);
   layout->addWidget(new QLabel("Object"),2,1);
   layout->addWidget(object,2,2);
   layout->addWidget(new QLabel("Lighting"),3,1);
   layout->addWidget(lighting,3,2);
   layout->addWidget(new QLabel("Angles"),4,1);
   layout->addWidget(angles,4,2);
   layout->addWidget(quit,6,2);
   //  Manage resizing
   layout->setColumnStretch(0,100);
   layout->setColumnMinimumWidth(0,100);
   layout->setRowStretch(5,100);
   setLayout(layout);

   //  Connect valueChanged() signals to ex01opengl
   connect(shader,SIGNAL(currentIndexChanged(int))     , ex01opengl,SLOT(setShader(int)));
   connect(object,SIGNAL(currentIndexChanged(int))     , ex01opengl,SLOT(setObject(int)));
   connect(projection,SIGNAL(currentIndexChanged(int)) , ex01opengl,SLOT(setPerspective(int)));
   connect(lighting,SIGNAL(stateChanged(int))          , ex01opengl,SLOT(setLighting(int)));
   //  Connect angles() signal to label
   connect(ex01opengl,SIGNAL(angles(QString)) , angles,SLOT(setText(QString)));
   //  Connect quit() signal to qApp::quit()
   connect(quit,SIGNAL(pressed()) , qApp,SLOT(quit()));
}
コード例 #25
0
void QGridLayoutProto::setColumnMinimumWidth(int column, int minSize)
{
  QGridLayout *item = qscriptvalue_cast<QGridLayout*>(thisObject());
  if (item)
    item->setColumnMinimumWidth(column, minSize);
}
コード例 #26
0
PeopleDefinitionInspectorView::PeopleDefinitionInspectorView(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()->addWidget(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("Name: ");
  label->setObjectName("H2");
  vLayout->addWidget(label);

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

  mainGridLayout->addLayout(vLayout,0,0,1,3, Qt::AlignTop);

  // number of people, people per area, and area per person
  vLayout = new QVBoxLayout();

  label = new QLabel("Number of People: ");
  label->setObjectName("H2");
  vLayout->addWidget(label);

  bool isConnected = false;

  m_numberofPeopleEdit = new OSDoubleEdit2();
  vLayout->addWidget(m_numberofPeopleEdit);

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

  vLayout = new QVBoxLayout();

  label = new QLabel("People per Space Floor Area: ");
  label->setObjectName("H2");
  vLayout->addWidget(label);

  m_peopleperSpaceFloorAreaEdit = new OSQuantityEdit2("people/m^2", "people/m^2", "people/ft^2", m_isIP);
  isConnected = connect(this, SIGNAL(toggleUnitsClicked(bool)), m_peopleperSpaceFloorAreaEdit, SLOT(onUnitSystemChange(bool)));
  OS_ASSERT(isConnected);
  vLayout->addWidget(m_peopleperSpaceFloorAreaEdit);

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

  vLayout = new QVBoxLayout();

  label = new QLabel("Space Floor Area per Person: ");
  label->setObjectName("H2");
  vLayout->addWidget(label);

  m_spaceFloorAreaperPersonEdit = new OSQuantityEdit2("m^2/person", "m^2/person", "ft^2/person", m_isIP);
  isConnected = connect(this, SIGNAL(toggleUnitsClicked(bool)), m_spaceFloorAreaperPersonEdit, SLOT(onUnitSystemChange(bool)));
  OS_ASSERT(isConnected);
  vLayout->addWidget(m_spaceFloorAreaperPersonEdit);

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

  // fraction radiance, sensible heat fraction, carbon dioxide rate
  vLayout = new QVBoxLayout();

  label = new QLabel("Fraction Radiant: ");
  label->setObjectName("H2");
  vLayout->addWidget(label);

  m_fractionRadiantEdit = new OSDoubleEdit2();
  vLayout->addWidget(m_fractionRadiantEdit);

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

  vLayout = new QVBoxLayout();

  label = new QLabel("Sensible Heat Fraction Radiant: ");
  label->setObjectName("H2");
  vLayout->addWidget(label);

  m_sensibleHeatFractionEdit = new OSDoubleEdit2();
  vLayout->addWidget(m_sensibleHeatFractionEdit);

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

  vLayout = new QVBoxLayout();

  label = new QLabel("Carbon Dioxide Generation Rate: ");
  label->setObjectName("H2");
  vLayout->addWidget(label);

  m_carbonDioxideGenerationRateEdit = new OSQuantityEdit2("m^3/s*W", "L/s*W", "ft^3*hr/min*Btu", m_isIP);
  isConnected = connect(this, SIGNAL(toggleUnitsClicked(bool)), m_carbonDioxideGenerationRateEdit, SLOT(onUnitSystemChange(bool)));
  OS_ASSERT(isConnected);
  vLayout->addWidget(m_carbonDioxideGenerationRateEdit);

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

  mainGridLayout->setColumnMinimumWidth(0, 80);
  mainGridLayout->setColumnMinimumWidth(1, 80);
  mainGridLayout->setColumnMinimumWidth(2, 80);
  mainGridLayout->setColumnStretch(3,1);
  mainGridLayout->setRowMinimumHeight(0, 30);
  mainGridLayout->setRowMinimumHeight(1, 30);
  mainGridLayout->setRowMinimumHeight(2, 30);
  mainGridLayout->setRowStretch(3,1);
}
コード例 #27
0
Window::Window(QWidget *parent, Qt::WindowFlags wf)
:	QMainWindow(parent, wf)
{
	QWidget* contents = new QWidget(this);
	setCentralWidget(contents);

	// Create preview
	m_preview = new QLabel(contents);
	m_preview->setFixedSize(80, 100);
	m_preview->setAutoFillBackground(true);
	{
		QPalette palette = m_preview->palette();
		palette.setColor(m_preview->backgroundRole(), Qt::black);
		m_preview->setPalette(palette);
	}

	// Create level display
	m_level = new QLabel("0", contents);
	m_level->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
	m_level->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
	m_level->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);

	// Create lines display
	m_lines = new QLabel("0", contents);
	m_lines->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
	m_lines->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
	m_lines->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);

	// Create score display
	m_score = new QLabel("0", contents);
	m_score->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
	m_score->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
	m_score->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);

	// Create scoreboard
	m_score_board = new ScoreBoard(this);

	// Create board
	m_board = new Board(contents);
	connect(m_board, &Board::pauseAvailable, this, &Window::pauseAvailable);
	connect(m_board, &Board::nextPieceAvailable, m_preview, &QLabel::setPixmap);
	connect(m_board, &Board::levelUpdated, m_level, static_cast<void (QLabel::*)(int)>(&QLabel::setNum));
	connect(m_board, &Board::linesRemovedUpdated, m_lines, static_cast<void (QLabel::*)(int)>(&QLabel::setNum));
	connect(m_board, &Board::scoreUpdated, this, &Window::scoreUpdated);
	connect(m_board, static_cast<void (Board::*)(int,int,int)>(&Board::gameOver), m_score_board, &ScoreBoard::addHighScore);
	connect(m_board, static_cast<void (Board::*)(int,int,int)>(&Board::gameOver), this, &Window::gameOver);
	connect(m_board, &Board::gameStarted, this, &Window::newGame);

	// Create overlay message
	QLabel* message = new QLabel(tr("Click to start a new game."), contents);
	message->setAttribute(Qt::WA_TransparentForMouseEvents);
	message->setAlignment(Qt::AlignCenter);
	message->setStyleSheet(
		"QLabel {"
			"background-color: rgba(255, 255, 255, 200);"
			"color: black;"
			"margin: 0;"
			"padding: 0.5em;"
			"border-radius: 0.5em;"
		"}");
	message->setWordWrap(true);
	connect(m_board, &Board::showMessage, message, &QLabel::show);
	connect(m_board, &Board::showMessage, message, &QLabel::setText);
	connect(m_board, &Board::hideMessage, message, &QLabel::hide);
	connect(m_board, &Board::hideMessage, message, &QLabel::clear);

	// Create menus
	QMenu* menu = menuBar()->addMenu(tr("&Game"));
	menu->addAction(tr("&New"), m_board, SLOT(newGame()), QKeySequence::New);
	m_pause_action = menu->addAction(tr("&Pause"), m_board, SLOT(pauseGame()), tr("P"));
	m_pause_action->setEnabled(false);
	m_resume_action = menu->addAction(tr("&Resume"), m_board, SLOT(resumeGame()), tr("P"));
	m_resume_action->setVisible(false);
	menu->addSeparator();
	menu->addAction(tr("&Scores"), m_score_board, SLOT(show()));
	menu->addSeparator();
	QAction* action = menu->addAction(tr("&Quit"), this, SLOT(close()), QKeySequence::Quit);
	action->setMenuRole(QAction::QuitRole);

	menu = menuBar()->addMenu(tr("&Settings"));
	menu->addAction(tr("Application &Language..."), this, SLOT(setLocale()));

	menu = menuBar()->addMenu(tr("&Help"));
	action = menu->addAction(tr("&About"), this, SLOT(about()));
	action->setMenuRole(QAction::AboutRole);
	action = menu->addAction(tr("About &Qt"), qApp, SLOT(aboutQt()));
	action->setMenuRole(QAction::AboutQtRole);

	// Layout window
	QGridLayout* layout = new QGridLayout(contents);
	layout->setMargin(12);
	layout->setSpacing(0);
	layout->setColumnStretch(0, 1);
	layout->setColumnMinimumWidth(1, 12);
	layout->setRowStretch(11, 1);
	layout->setRowMinimumHeight(2, 24);
	layout->setRowMinimumHeight(5, 24);
	layout->setRowMinimumHeight(8, 24);
	layout->addWidget(m_board, 0, 0, 12, 1);
	layout->addWidget(message, 0, 0, 12, 1, Qt::AlignCenter);
	layout->addWidget(new QLabel(tr("Next Piece"), contents), 0, 2, 1, 1, Qt::AlignCenter);
	layout->addWidget(m_preview, 1, 2, Qt::AlignCenter);
	layout->addWidget(new QLabel(tr("Level"), contents), 3, 2, 1, 1, Qt::AlignCenter);
	layout->addWidget(m_level, 4, 2);
	layout->addWidget(new QLabel(tr("Removed Lines"), contents), 6, 2, 1, 1, Qt::AlignCenter);
	layout->addWidget(m_lines, 7, 2);
	layout->addWidget(new QLabel(tr("Score"), contents), 9, 2, 1, 1, Qt::AlignCenter);
	layout->addWidget(m_score, 10, 2);

	// Restore window
	restoreGeometry(QSettings().value("Geometry").toByteArray());
}
コード例 #28
0
ShadingSurfaceGroupInspectorView::ShadingSurfaceGroupInspectorView(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);

  // direction of relative north 
  vLayout = new QVBoxLayout();

  label = new QLabel();
  label->setText("Direction of relative north: ");
  label->setStyleSheet("QLabel { font: bold; }");
  vLayout->addWidget(label);

  m_directionofRelativeNorthEdit = new OSQuantityEdit(m_isIP);
  connect(this, &ShadingSurfaceGroupInspectorView::toggleUnitsClicked, m_directionofRelativeNorthEdit, &OSQuantityEdit::onUnitSystemChange);
  vLayout->addWidget(m_directionofRelativeNorthEdit);

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

  // x, y, and z origin
  vLayout = new QVBoxLayout();

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

  m_xOriginEdit = new OSQuantityEdit(m_isIP);
  connect(this, &ShadingSurfaceGroupInspectorView::toggleUnitsClicked, m_xOriginEdit, &OSQuantityEdit::onUnitSystemChange);
  vLayout->addWidget(m_xOriginEdit);

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

  vLayout = new QVBoxLayout();

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

  m_yOriginEdit = new OSQuantityEdit(m_isIP);
  connect(this, &ShadingSurfaceGroupInspectorView::toggleUnitsClicked, m_yOriginEdit, &OSQuantityEdit::onUnitSystemChange);
  vLayout->addWidget(m_yOriginEdit);

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

  vLayout = new QVBoxLayout();

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

  m_zOriginEdit = new OSQuantityEdit(m_isIP);
  connect(this, &ShadingSurfaceGroupInspectorView::toggleUnitsClicked, m_zOriginEdit, &OSQuantityEdit::onUnitSystemChange);
  vLayout->addWidget(m_zOriginEdit);

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

  mainGridLayout->setColumnMinimumWidth(0, 100);
  mainGridLayout->setColumnMinimumWidth(1, 100);
  mainGridLayout->setColumnStretch(2,1);
  mainGridLayout->setRowMinimumHeight(0, 30);
  mainGridLayout->setRowMinimumHeight(1, 30);
  mainGridLayout->setRowMinimumHeight(2, 30);
  mainGridLayout->setRowStretch(3,1);
}
コード例 #29
0
ファイル: coordinatecapture.cpp プロジェクト: ndavid/QGIS
/*
 * Initialize the GUI interface for the plugin - this is only called once when the plugin is
 * added to the plugin registry in the QGIS application.
 */
void CoordinateCapture::initGui()
{
  mCrs.createFromSrsId( GEOCRS_ID ); // initialize the CRS object

  connect( mQGisIface->mapCanvas(), &QgsMapCanvas::destinationCrsChanged, this, &CoordinateCapture::setSourceCrs );
  connect( mQGisIface, &QgisInterface::currentThemeChanged, this, &CoordinateCapture::setCurrentTheme );

  setSourceCrs(); //set up the source CRS
  mTransform.setDestinationCrs( mCrs ); // set the CRS in the transform
  mUserCrsDisplayPrecision = ( mCrs.mapUnits() == QgsUnitTypes::DistanceDegrees ) ? 5 : 3; // precision depends on CRS units

  //create the dock widget
  mpDockWidget = new QgsDockWidget( tr( "Coordinate Capture" ), mQGisIface->mainWindow() );
  mpDockWidget->setObjectName( QStringLiteral( "CoordinateCapture" ) );
  mpDockWidget->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
  mQGisIface->addDockWidget( Qt::LeftDockWidgetArea, mpDockWidget );

  // Create the action for tool
  mQActionPointer = new QAction( QIcon(), tr( "Coordinate Capture" ), this );
  mQActionPointer->setObjectName( QStringLiteral( "mQActionPointer" ) );
  mQActionPointer->setCheckable( true );
  mQActionPointer->setChecked( mpDockWidget->isVisible() );
  // Set the what's this text
  mQActionPointer->setWhatsThis( tr( "Click on the map to view coordinates and capture to clipboard." ) );
  // Connect the action to the run
  connect( mQActionPointer, &QAction::triggered, this, &CoordinateCapture::showOrHide );
  mQGisIface->addPluginToVectorMenu( tr( "&Coordinate Capture" ), mQActionPointer );
  mQGisIface->addVectorToolBarIcon( mQActionPointer );

  // create our map tool
  mpMapTool = new CoordinateCaptureMapTool( mQGisIface->mapCanvas() );
  connect( mpMapTool, &CoordinateCaptureMapTool::mouseMoved, this, &CoordinateCapture::mouseMoved );
  connect( mpMapTool, &CoordinateCaptureMapTool::mouseClicked, this, &CoordinateCapture::mouseClicked );

  // create a little widget with x and y display to put into our dock widget
  QWidget *mypWidget = new QWidget();
  QGridLayout *mypLayout = new QGridLayout( mypWidget );
  mypLayout->setColumnMinimumWidth( 0, 36 );
  mypWidget->setLayout( mypLayout );

  mypUserCrsToolButton = new QToolButton( mypWidget );
  mypUserCrsToolButton->setToolTip( tr( "Click to select the CRS to use for coordinate display" ) );
  connect( mypUserCrsToolButton, &QAbstractButton::clicked, this, &CoordinateCapture::setCRS );

  mypCRSLabel = new QLabel( mypWidget );
  mypCRSLabel->setGeometry( mypUserCrsToolButton->geometry() );

  mpUserCrsEdit = new QLineEdit( mypWidget );
  mpUserCrsEdit->setReadOnly( true );
  mpUserCrsEdit->setToolTip( tr( "Coordinate in your selected CRS (lat,lon or east,north)" ) );

  mpCanvasEdit = new QLineEdit( mypWidget );
  mpCanvasEdit->setReadOnly( true );
  mpCanvasEdit->setToolTip( tr( "Coordinate in map canvas coordinate reference system (lat,lon or east,north)" ) );

  QPushButton *mypCopyButton = new QPushButton( mypWidget );
  mypCopyButton->setText( tr( "Copy to clipboard" ) );
  connect( mypCopyButton, &QAbstractButton::clicked, this, &CoordinateCapture::copy );

  mpTrackMouseButton = new QToolButton( mypWidget );
  mpTrackMouseButton->setCheckable( true );
  mpTrackMouseButton->setToolTip( tr( "Click to enable mouse tracking. Click the canvas to stop" ) );
  mpTrackMouseButton->setChecked( false );

  // Create the action for tool
  mpCaptureButton = new QPushButton( mypWidget );
  mpCaptureButton->setText( tr( "Start capture" ) );
  mpCaptureButton->setToolTip( tr( "Click to enable coordinate capture" ) );
  mpCaptureButton->setIcon( QIcon( ":/coordinate_capture/coordinate_capture.png" ) );
  mpCaptureButton->setWhatsThis( tr( "Click on the map to view coordinates and capture to clipboard." ) );
  connect( mpCaptureButton, &QAbstractButton::clicked, this, &CoordinateCapture::run );

  // Set the icons
  setCurrentTheme( QLatin1String( "" ) );

  mypLayout->addWidget( mypUserCrsToolButton, 0, 0 );
  mypLayout->addWidget( mpUserCrsEdit, 0, 1 );
  mypLayout->addWidget( mypCRSLabel, 1, 0 );
  mypLayout->addWidget( mpCanvasEdit, 1, 1 );
  mypLayout->addWidget( mpTrackMouseButton, 2, 0 );
  mypLayout->addWidget( mypCopyButton, 2, 1 );
  mypLayout->addWidget( mpCaptureButton, 3, 1 );

  // now add our custom widget to the dock - ownership of the widget is passed to the dock
  mpDockWidget->setWidget( mypWidget );
  connect( mpDockWidget.data(), &QDockWidget::visibilityChanged, mQActionPointer, &QAction::setChecked );
}
コード例 #30
0
ファイル: SSHTunnelTab.cpp プロジェクト: aturki/robomongo
    SshTunnelTab::SshTunnelTab(ConnectionSettings *settings) :
        _settings(settings)
    {
        SshSettings *info = settings->sshSettings();
        _sshSupport = new QCheckBox("Use SSH tunnel");
        _sshSupport->setStyleSheet("margin-bottom: 7px");
        _sshSupport->setChecked(info->enabled());

        _askForPassword = new QCheckBox(askPasswordText);
        _askForPassword->setChecked(info->askPassword());
        VERIFY(connect(_askForPassword, SIGNAL(stateChanged(int)), this, SLOT(askForPasswordStateChanged(int))));

        _sshHostName = new QLineEdit(QtUtils::toQString(info->host()));
        _userName = new QLineEdit(QtUtils::toQString(info->userName()));

        _sshPort = new QLineEdit(QString::number(info->port()));
        _sshPort->setFixedWidth(40);
        QRegExp rx("\\d+"); //(0-65554)
        _sshPort->setValidator(new QRegExpValidator(rx, this));        

        _security = new QComboBox();
        _security->addItems(QStringList() << "Password" << "Private Key");
        VERIFY(connect(_security, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(securityChange(const QString&))));

        _passwordBox = new QLineEdit(QtUtils::toQString(info->userPassword()));
        _passwordBox->setEchoMode(QLineEdit::Password);
        _passwordEchoModeButton = new QPushButton;
        VERIFY(connect(_passwordEchoModeButton, SIGNAL(clicked()), this, SLOT(togglePasswordEchoMode())));
        togglePasswordEchoMode();

        _privateKeyBox = new QLineEdit(QtUtils::toQString(info->privateKeyFile()));
        
        _passphraseBox = new QLineEdit(QtUtils::toQString(info->passphrase()));
        _passphraseBox->setEchoMode(QLineEdit::Password);
        _passphraseEchoModeButton = new QPushButton;
        VERIFY(connect(_passphraseEchoModeButton, SIGNAL(clicked()), this, SLOT(togglePassphraseEchoMode())));
        togglePassphraseEchoMode();

        _passwordLabel = new QLabel("User Password:"******"Private key:");
        _sshPassphraseLabel = new QLabel("Passphrase:");
        _sshAddressLabel = new QLabel("SSH Address:");
        _sshUserNameLabel = new QLabel("SSH User Name:");
        _sshAuthMethodLabel = new QLabel("SSH Auth Method:");

/*
// Commented because of this:
// https://github.com/paralect/robomongo/issues/391

#ifdef Q_OS_WIN
        QRegExp pathx("([a-zA-Z]:)?([\\\\/][a-zA-Z0-9_.-]+)+[\\\\/]?");
#else
        QRegExp pathx("^\\/?([\\d\\w\\.]+)(/([\\d\\w\\.]+))*\\/?$");
#endif // Q_OS_WIN
        _publicKeyBox->setValidator(new QRegExpValidator(pathx, this));
        _privateKeyBox->setValidator(new QRegExpValidator(pathx, this));
*/

        QHBoxLayout *hostAndPasswordLayout = new QHBoxLayout;
        hostAndPasswordLayout->addWidget(_sshHostName);
        hostAndPasswordLayout->addWidget(new QLabel(":"));
        hostAndPasswordLayout->addWidget(_sshPort);

        QGridLayout *connectionLayout = new QGridLayout;
        connectionLayout->setAlignment(Qt::AlignTop);
        connectionLayout->setColumnStretch(1, 1);
        connectionLayout->setColumnMinimumWidth(0, _passwordLabel->sizeHint().width() + 5);

        connectionLayout->addWidget(_sshAddressLabel ,             1, 0);
        connectionLayout->addLayout(hostAndPasswordLayout,         1, 1, 1, 2);

        connectionLayout->addWidget(_sshUserNameLabel,             2, 0);
        connectionLayout->addWidget(_userName,                     2, 1, 1, 2);

        connectionLayout->addWidget(_sshAuthMethodLabel,           4, 0);
        connectionLayout->addWidget(_security,                     4, 1, 1, 2);

        connectionLayout->addWidget(_passwordLabel,                5, 0);
        connectionLayout->addWidget(_passwordBox,                  5, 1);
        connectionLayout->addWidget(_passwordEchoModeButton,       5, 2);

        _selectPrivateFileButton = new QPushButton("...");
        _selectPrivateFileButton->setMaximumWidth(50);

        connectionLayout->addWidget(_sshPrivateKeyLabel,           7, 0);
        connectionLayout->addWidget(_privateKeyBox,                7, 1);
        connectionLayout->addWidget(_selectPrivateFileButton,      7, 2);

        connectionLayout->addWidget(_sshPassphraseLabel,           8, 0);
        connectionLayout->addWidget(_passphraseBox,                8, 1);
        connectionLayout->addWidget(_passphraseEchoModeButton,     8, 2);
        connectionLayout->addWidget(_askForPassword,               9, 1, 1, 2);

        QVBoxLayout *mainLayout = new QVBoxLayout;
        mainLayout->addWidget(_sshSupport);
        mainLayout->addLayout(connectionLayout);
        setLayout(mainLayout);

        if (info->authMethod() == "publickey") {
            utils::setCurrentText(_security, "Private Key");
        } else {
            utils::setCurrentText(_security, "Password");
        }

        securityChange(_security->currentText());
        VERIFY(connect(_selectPrivateFileButton, SIGNAL(clicked()), this, SLOT(setPrivateFile())));

        sshSupportStateChange(_sshSupport->checkState());
        VERIFY(connect(_sshSupport, SIGNAL(stateChanged(int)), this, SLOT(sshSupportStateChange(int))));

        _sshHostName->setFocus();

#ifdef Q_OS_MAC
        _passwordEchoModeButton->setMaximumWidth(_selectPrivateFileButton->width());
        _passphraseEchoModeButton->setMaximumWidth(_selectPrivateFileButton->width());
#else
        _passwordEchoModeButton->setMinimumWidth(_selectPrivateFileButton->width());
        _passphraseEchoModeButton->setMinimumWidth(_selectPrivateFileButton->width());
#endif
        // Attempt to fix the issue for Windows High DPI button height is slightly taller than other widgets 
#ifdef Q_OS_WIN
        _passwordEchoModeButton->setMaximumHeight(HighDpiContants::WIN_HIGH_DPI_BUTTON_HEIGHT);
        _passphraseEchoModeButton->setMaximumHeight(HighDpiContants::WIN_HIGH_DPI_BUTTON_HEIGHT);
        _selectPrivateFileButton->setMaximumHeight(HighDpiContants::WIN_HIGH_DPI_BUTTON_HEIGHT);
#endif

    }