示例#1
0
void QToDoContent::initUI()
{
    QVBoxLayout *vlay = new QVBoxLayout(this);
    QWidget *centerWidget = new QWidget(this);
    QGridLayout *grid = new QGridLayout(centerWidget);

    vlay->setContentsMargins(0,0,0,0);
    grid->setContentsMargins(0,0,0,0);
    grid->setSpacing(5);
    m_tree = new QTreeView(centerWidget);
    m_tree->setGeometry(QRect(0,0,400,300));
    m_tree->setMaximumWidth(200);
    m_edit = new QTextEdit(centerWidget);
    m_okBtn = new QPureColorButton(centerWidget);
    m_cancelBtn = new QPureColorButton(centerWidget);
    m_okBtn->setMaximumHeight(40);
    m_cancelBtn->setMaximumHeight(40);
    connect(m_okBtn,SIGNAL(clicked()),this,SLOT(ok_clicked()));
    connect(m_cancelBtn,SIGNAL(clicked()),this,SLOT(close()));
    m_okBtn->setButtonText(LOCAL("确认选择"));
    m_cancelBtn->setButtonText(LOCAL("取消"));
    m_okBtn->setMaximumWidth(80);
    m_cancelBtn->setMaximumWidth(80);
    m_model = new QStandardItemModel(this);
    m_model->setColumnCount(2);
    m_tree->setModel(m_model);
    m_tree->setColumnWidth(0,600);

    grid->addWidget(m_tree,0,0,3,1,Qt::AlignLeft);
    grid->addWidget(m_edit,0,1,2,8);
    grid->addWidget(m_okBtn,2,6,1,1);
    grid->addWidget(m_cancelBtn,2,7,1,1);

    vlay->addWidget(centerWidget);
}
// constructor
LineObjectDialog::LineObjectDialog (QWidget * parent):
  QDialog (parent), ui (new Ui::LineObjectDialog)
{
  QAbstractButton *button;		
  ui->setupUi (this);
  this->setWindowFlags(Qt::CustomizeWindowHint);
  
  color = Qt::white;
  pixmap = new QPixmap (16, 16);
  icon = new QIcon;
  pixmap->fill (color);
  icon->addPixmap (*pixmap, QIcon::Normal, QIcon::On);
  ui->colorButton->setIcon (*icon);
#ifdef Q_OS_WIN  
  colorDialog = new QColorDialog (this);
#else
  colorDialog = new QColorDialog; // (this);
#endif    
  colorDialog->setModal (true);
  
  foreach (button, ui->buttonBox->buttons ())
    button->setFocusPolicy (Qt::NoFocus);
  
  connect(ui->colorButton, SIGNAL(clicked (bool)), this, SLOT(color_clicked(void)));
  connect (colorDialog, SIGNAL (accepted ()), this, SLOT (colorDialog_accepted ()));
  connect(ui->buttonBox, SIGNAL(accepted ()), this, SLOT(ok_clicked ()));
  connect(ui->buttonBox, SIGNAL(rejected ()), this, SLOT(cancel_clicked ()));
  
  correctWidgetFonts (this);
}
示例#3
0
bool awari::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: reset(); break;
    case 1: takeopp((QValueList<int>::iterator)(*((QValueList<int>::iterator*)static_QUType_ptr.get(_o+1))),(int)static_QUType_int.get(_o+2)); break;
    case 2: display(); break;
    case 3: p1_clicked(); break;
    case 4: p2_clicked(); break;
    case 5: p3_clicked(); break;
    case 6: p4_clicked(); break;
    case 7: p5_clicked(); break;
    case 8: movec5(); break;
    case 9: movec4(); break;
    case 10: movec3(); break;
    case 11: movec2(); break;
    case 12: movec1(); break;
    case 13: movecomp(); break;
    case 14: movecomp((QValueList<int>::iterator)(*((QValueList<int>::iterator*)static_QUType_ptr.get(_o+1)))); break;
    case 15: checkwin(); break;
    case 16: comp1st_clicked(); break;
    case 17: spinBox_valueChanged((int)static_QUType_int.get(_o+1)); break;
    case 18: ok_clicked(); break;
    case 19: languageChange(); break;
    default:
	return QWizard::qt_invoke( _id, _o );
    }
    return TRUE;
}
示例#4
0
QtnpGraphicDialog::QtnpGraphicDialog(QWidget *parent) :
        QDialog(parent),
        ui(new Ui::QtnpGraphicDialog)
{
	ui->setupUi(this);
	line_color_widget = new QtnpColorWidget(0,0,0,24);
	prop_spacer = new QSpacerItem(1,1,QSizePolicy::Expanding,QSizePolicy::Minimum);

	ui->propLayout->addWidget(line_color_widget);
	ui->propLayout->addSpacerItem(prop_spacer);

	connect(ui->okB,SIGNAL(clicked()),this,SLOT(ok_clicked()));
}
示例#5
0
cNewProjectWindow::cNewProjectWindow(cMainController *parent) :
  QDialog(parent->get_main_window_ref()),
  ui(new Ui::cNewProjectWindow)
{
  ui->setupUi(this);

  m_controller = parent;

  setWindowTitle("New Project");
  setModal(true);

  connect(ui->btn_ok,SIGNAL(clicked()),this,SLOT(ok_clicked()));
  connect(ui->btn_cancel,SIGNAL(clicked()),this,SLOT(cancel_clicked()));

}
示例#6
0
ImporterDialog::ImporterDialog(QWidget * parent) :
  QFileDialog(parent)
{
  setWindowTitle(tr("New Importer"));

  _import = new QLabel(tr("Importer Name"));
  _importname = new QLineEdit;
  _import->setBuddy(_importname);
  
  _directory = new QLabel(tr("Directory Location"));
  _directoryname = new QLineEdit;
  //set a default directory from the settings
  QSettings settings;
  settings.beginGroup("LastImporter");
  _directoryname->setText( settings.value("directory",QString(getenv("HOME"))).toString());
  settings.endGroup();

  _directory->setBuddy(_directoryname);
  _search = new QPushButton(tr("Search"));
  
  connect(_search, SIGNAL(clicked()), this, SLOT(open_directory_search()));
  
  QWidget * directory = new QWidget;
  QHBoxLayout * directory_layout = new QHBoxLayout;
  directory_layout->addWidget( _directory);
  directory_layout->addWidget( _directoryname);
  directory_layout->addWidget( _search);
  directory->setLayout(directory_layout);

  QWidget * buttons = new QWidget;
  _ok = new QPushButton(tr("OK"));
  connect(_ok, SIGNAL(clicked()), this, SLOT(ok_clicked()));
  _cancel = new QPushButton(tr("CANCEL"));
  connect(_cancel, SIGNAL(clicked()), this, SLOT(reject()));

  QHBoxLayout * bottom_buttons = new QHBoxLayout;
  bottom_buttons->addWidget(_ok);
  bottom_buttons->addWidget(_cancel);
  buttons->setLayout(bottom_buttons);

  QVBoxLayout * topdown = new QVBoxLayout();
  topdown->addWidget(_import);
  topdown->addWidget(_importname);
  topdown->addWidget(directory);
  topdown->addWidget(buttons);
  setLayout(topdown);
  //here we need to set some signals
}
/**
 * Constructor.
 */
CQSBMLSaveOptionsDialog::CQSBMLSaveOptionsDialog(QWidget * pParent , const char * name): QDialog(pParent, name, true)
    , mCompressionType(CQSBMLSaveOptionsDialog::NONE)
    , mSaveCOPASIMIRIAM(true)
    , mpLayout(new QVBoxLayout(this))
    , mpVersionBox(new QComboBox(false, this))
    , mpMIRIAMCheckbox(new QCheckBox("Save COPASI MIRIAM annotation", this))
    , mpCompressionGroup(new QButtonGroup(2, Qt::Horizontal, "Compression", this))
    , mpOKButton(new QPushButton("Export", this))
    , mpCancelButton(new QPushButton("Cancel", this))
{
  // add the widgets to the layout
  std::vector<std::pair<unsigned C_INT32, unsigned C_INT32> > levelsAndVersions;
  levelsAndVersions.push_back(std::pair<unsigned C_INT32, unsigned C_INT32>(1, 2));
  levelsAndVersions.push_back(std::pair<unsigned C_INT32, unsigned C_INT32>(2, 1));
  levelsAndVersions.push_back(std::pair<unsigned C_INT32, unsigned C_INT32>(2, 2));
  levelsAndVersions.push_back(std::pair<unsigned C_INT32, unsigned C_INT32>(2, 3));
  levelsAndVersions.push_back(std::pair<unsigned C_INT32, unsigned C_INT32>(2, 4));
  this->setLevelsAndVersions(levelsAndVersions);
  this->setLevelAndVersion(std::pair<unsigned C_INT32, unsigned C_INT32>(2, 3));
  // that the widget has a fixed size determined by it's elements
  this->mpLayout->setResizeMode(QLayout::Fixed);
  this->mpLayout->addSpacing(5);
  QHBoxLayout* pLayout = new QHBoxLayout();
  this->mpLayout->addLayout(pLayout);
  pLayout->addSpacing(5);
  pLayout->addWidget(new QLabel("SBML Version:", this));
  pLayout->addSpacing(5);
  pLayout->addWidget(this->mpVersionBox);
  pLayout->addSpacing(5);
  // the compression feature is disabled for now since the libsbml we use
  // does not have the dependencies
  //this->mpLayout->addSpacing(8);
  //this->mpLayout->addWidget(this->mpCompressionGroup);
  // add the buttons to the compression group
  this->mpCompressionGroup->setRadioButtonExclusive(true);
  new QRadioButton("none", this->mpCompressionGroup);
  new QRadioButton("zip", this->mpCompressionGroup);
  new QRadioButton("gzip", this->mpCompressionGroup);
  new QRadioButton("bzip2", this->mpCompressionGroup);
  this->mpCompressionGroup->setButton(this->mCompressionType);
  this->mpCompressionGroup->hide();
  this->mpLayout->addSpacing(8);
  pLayout = new QHBoxLayout();
  this->mpLayout->addLayout(pLayout);
  QToolTip::add(this->mpMIRIAMCheckbox, "Export additional MIRIAM annotation in the COPASI namespace.");
  this->mpMIRIAMCheckbox->setChecked(this->mSaveCOPASIMIRIAM);
  pLayout->addStretch();
  pLayout->addWidget(this->mpMIRIAMCheckbox);
  pLayout->addStretch();
  this->mpLayout->addSpacing(8);
  pLayout = new QHBoxLayout();
  this->mpLayout->addLayout(pLayout);
  // make OK button the default
  // add some space between the buttons and before and after them
  pLayout->addStretch();
  pLayout->addWidget(this->mpOKButton);
  pLayout->addStretch();
  pLayout->addWidget(this->mpCancelButton);
  pLayout->addStretch();
  this->mpOKButton->setDefault(true);
  this->mpLayout->addSpacing(5);
  // set the tab order
  this->setTabOrder(this->mpVersionBox, this->mpCompressionGroup);
  this->setTabOrder(this->mpCompressionGroup, this->mpMIRIAMCheckbox);
  this->setTabOrder(this->mpMIRIAMCheckbox, this->mpOKButton);
  this->setTabOrder(this->mpOKButton, this->mpCancelButton);

  // connect the signals and slots
  connect(this->mpMIRIAMCheckbox, SIGNAL(toggled(bool)), this, SLOT(miriam_toggled(bool)));
  connect(this->mpCompressionGroup, SIGNAL(clicked(int)), this, SLOT(compression_clicked(int)));
  connect(this->mpOKButton, SIGNAL(clicked()), this, SLOT(ok_clicked()));
  connect(this->mpCancelButton, SIGNAL(clicked()), this, SLOT(cancel_clicked()));
}