Exemplo n.º 1
0
NoteView::NoteView(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::NoteView)
{
    //initialize controller
    ui->setupUi(this);
    this->_controller = new NoteController();

    //prepare green button
    QFile data(":/new/prefix1/greenButton.qss");
    data.open(QFile::ReadOnly);
    QTextStream styleIn(&data);
    this->_greenButton = styleIn.readAll();
    data.close();

    //fix screen size
    this->setFixedSize(this->width(), this->height());

    //setup error fields
    ui->addError->setStyleSheet("QLabel {color:red};");
    ui->bodyError->setStyleSheet("QLabel {color:red};");
    clear();

    //connect signals and slots
    connect(ui->doneButton, SIGNAL(clicked()), this, SLOT(doneClicked()));
    connect(ui->nextButton, SIGNAL(clicked()), this, SLOT(nextClicked()));
    connect(ui->prevButton, SIGNAL(clicked()), this, SLOT(prevClicked()));
    connect(ui->deleteButton, SIGNAL(clicked()), this, SLOT(deleteClicked()));
    connect(ui->addButton, SIGNAL(clicked()), this, SLOT(addClicked()));
    connect(ui->editButton,SIGNAL(clicked()),this,SLOT(editClicked()));
}
Exemplo n.º 2
0
KCMRulesList::KCMRulesList(QWidget* parent)
    : QWidget(parent)
{
    setupUi(this);
    // connect both current/selected, so that current==selected (stupid QListBox :( )
    connect(rules_listbox, SIGNAL(itemChanged(QListWidgetItem*)),
            SLOT(activeChanged()));
    connect(rules_listbox, SIGNAL(itemSelectionChanged()),
            SLOT(activeChanged()));
    connect(new_button, SIGNAL(clicked()),
            SLOT(newClicked()));
    connect(modify_button, SIGNAL(clicked()),
            SLOT(modifyClicked()));
    connect(delete_button, SIGNAL(clicked()),
            SLOT(deleteClicked()));
    connect(moveup_button, SIGNAL(clicked()),
            SLOT(moveupClicked()));
    connect(movedown_button, SIGNAL(clicked()),
            SLOT(movedownClicked()));
    connect(export_button, SIGNAL(clicked()),
            SLOT(exportClicked()));
    connect(import_button, SIGNAL(clicked()),
            SLOT(importClicked()));
    connect(rules_listbox, SIGNAL(itemDoubleClicked(QListWidgetItem*)),
            SLOT(modifyClicked()));
    load();
}
Exemplo n.º 3
0
/*
 * Initialize
 */
void MovieSequenceForm::init()
{
  setAttribute(Qt::WA_DeleteOnClose);
  setAttribute(Qt::WA_AlwaysShowToolTips);
  mSegments = mvMovieSegmentArray();
  connect(doneButton, SIGNAL(clicked()), this, SLOT(close()));
  connect(addAfterButton, SIGNAL(clicked()), this, SLOT(addAfterClicked()));
  connect(addBeforeButton, SIGNAL(clicked()), this, SLOT(addBeforeClicked()));
  connect(replaceButton, SIGNAL(clicked()), this, SLOT(replaceClicked()));
  connect(deleteButton, SIGNAL(clicked()), this, SLOT(deleteClicked()));
  connect(setMovieButton, SIGNAL(clicked()), this, SLOT(setMovieClicked()));
  connect(setStartButton, SIGNAL(clicked()), this, SLOT(setStartClicked()));
  connect(setEndButton, SIGNAL(clicked()), this, SLOT(setEndClicked()));
  connect(runAllButton, SIGNAL(clicked()), this, SLOT(runAllClicked()));
  connect(saveButton, SIGNAL(clicked()), this, SLOT(saveClicked()));
  connect(loadButton, SIGNAL(clicked()), this, SLOT(loadClicked()));
  connect(helpButton, SIGNAL(clicked()), this, SLOT(helpClicked()));
  connect(table, SIGNAL(cellChanged(int, int)), this, SLOT(entryChanged(int,int)));
  setFontDependentWidths();
  mModified = false;

  // Change window size to give 4 rows plus header
  imod_info_input();
  adjustSize();
  QSize winSize = sizeHint();
  QSize tableSize = table->sizeHint();
  int desired = 5.6 * (table->fontMetrics().height() + 3);
  resize(winSize.width(), winSize.height() + (desired - tableSize.height()));
}
Exemplo n.º 4
0
RateCenterManager::RateCenterManager
(
	QWidget* parent,
	const char* name
) : TAAWidget(parent)
{
    setCaption( "Rate Center Manager" );

    rcList = new Q3ListView(this, "Rate Center Manager");
    rcList->setAllColumnsShowFocus(true);
    rcList->setRootIsDecorated(true);
    rcList->addColumn("Country/State/City");
    rcList->addColumn("Active");
    rcList->addColumn("Avail");
    rcList->addColumn("Total");
    connect(rcList, SIGNAL(doubleClicked(Q3ListViewItem *)), this, SLOT(itemDoubleClicked(Q3ListViewItem *)));

    activeColumn    = 1;
    availColumn     = 2;
    totalColumn     = 3;
    idColumn        = 4;

    rcList->setColumnAlignment(activeColumn, Qt::AlignRight);
    rcList->setColumnAlignment(availColumn,  Qt::AlignRight);
    rcList->setColumnAlignment(totalColumn,  Qt::AlignRight);


    addButton = new QPushButton(this, "Add Button");
    addButton->setText("&Add");
    connect(addButton, SIGNAL(clicked()), this, SLOT(addClicked()));

    editButton = new QPushButton(this, "Edit Button");
    editButton->setText("&Edit");
    connect(editButton, SIGNAL(clicked()), this, SLOT(editClicked()));

    deleteButton = new QPushButton(this, "Delete Button");
    deleteButton->setText("&Delete");
    connect(deleteButton, SIGNAL(clicked()), this, SLOT(deleteClicked()));
    deleteButton->setEnabled(false);

    closeButton = new QPushButton(this, "Close Button");
    closeButton->setText("&Close");
    connect(closeButton, SIGNAL(clicked()), this, SLOT(closeClicked()));

    Q3BoxLayout  *ml = new Q3BoxLayout(this, Q3BoxLayout::TopToBottom, 3, 3);
    ml->addWidget(rcList, 1);

    
    Q3BoxLayout  *bl = new Q3BoxLayout(Q3BoxLayout::LeftToRight, 1);
    bl->addStretch(1);
    bl->addWidget(addButton, 0);
    bl->addWidget(editButton, 0);
    bl->addWidget(deleteButton, 0);
    bl->addWidget(closeButton, 0);

    ml->addLayout(bl, 0);

    refreshRateCenters();
}
Exemplo n.º 5
0
SourceItemWidget::SourceItemWidget(const QString& labelText)
{
    QPushButton* del;
    QHBoxLayout* layout = new QHBoxLayout(this);
    layout->addWidget( m_image = new QLabel, 0, Qt::AlignLeft );
    layout->addWidget( m_label = new QLabel, 0, Qt::AlignLeft );
    layout->addWidget( del = new QPushButton("X"), 0, Qt::AlignRight );
    m_image->setObjectName( "image" );
    m_image->setProperty( "noImage", true );
    m_label->setText( labelText );
    connect(del, SIGNAL(clicked()), SIGNAL(deleteClicked()));
}
Exemplo n.º 6
0
EditCalendarsPage::EditCalendarsPage(QWidget *parent)
    :QWidget(parent),
    m_manager(0)
{
    m_calendarList = new QListWidget(this);
    connect(m_calendarList, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(itemDoubleClicked(QListWidgetItem *)));

#ifndef Q_OS_SYMBIAN
    // Add push buttons for non-Symbian platforms as they do not support soft keys
    QHBoxLayout* hbLayout = new QHBoxLayout();
    QPushButton *addButton = new QPushButton("Add new", this);
    connect(addButton,SIGNAL(clicked()), this, SIGNAL(addClicked()));
    hbLayout->addWidget(addButton);
    QPushButton *editButton = new QPushButton("Edit", this);
    connect(editButton,SIGNAL(clicked()),this,SLOT(editClicked()));
    hbLayout->addWidget(editButton);
    QPushButton *deleteButton = new QPushButton("Delete", this);
    connect(deleteButton,SIGNAL(clicked()),this,SLOT(deleteClicked()));
    hbLayout->addWidget(deleteButton);
    QPushButton *backButton = new QPushButton("Back", this);
    connect(backButton,SIGNAL(clicked()),this,SLOT(backClicked()));
    hbLayout->addWidget(backButton);
#endif

    QVBoxLayout *scrollAreaLayout = new QVBoxLayout();
    scrollAreaLayout->addWidget(m_calendarList);

#ifndef Q_OS_SYMBIAN
    scrollAreaLayout->addLayout(hbLayout);
#endif

    QScrollArea *scrollArea = new QScrollArea(this);
    scrollArea->setWidgetResizable(true);
    QWidget *formContainer = new QWidget(scrollArea);
    formContainer->setLayout(scrollAreaLayout);
    scrollArea->setWidget(formContainer);

    QVBoxLayout *mainLayout = new QVBoxLayout();
    mainLayout->addWidget(scrollArea);
    setLayout(mainLayout);

    // Add softkeys
    QAction* cancelSoftKey = new QAction("Back", this);
    cancelSoftKey->setSoftKeyRole(QAction::NegativeSoftKey);
    addAction(cancelSoftKey);
    connect(cancelSoftKey, SIGNAL(triggered(bool)), this, SLOT(backClicked()));

    QAction* editSoftKey = new QAction("Edit",this);
    editSoftKey->setSoftKeyRole(QAction::PositiveSoftKey); // Perhaps SelectSoftKey
    addAction(editSoftKey);
    connect(editSoftKey, SIGNAL(triggered(bool)), this, SLOT(editClicked()));
}
Exemplo n.º 7
0
CQTabWidget::CQTabWidget(const ListViews::ObjectType & objectType, CopasiWidget * pCopasiWidget,
                         QWidget * parent, Qt::WindowFlags f) :
  CopasiWidget(parent, NULL, f),
  mPages(),
  mObjectType(objectType),
  mIgnoreLeave(false)
{
  setupUi(this);

  mpLblName->setText("<h3>" + FROM_UTF8(ListViews::ObjectTypeName[mObjectType]) + "</h3>");

  mpTabWidget->addTab(pCopasiWidget, "Details");
  mPages.push_back(pCopasiWidget);

  switch (mObjectType)
    {
      case  ListViews::MODEL:
        mpBtnNew->hide();
        mpBtnCopy->hide();
        mpBtnDelete->hide();
        break;

      case ListViews::MODELPARAMETERSET:
        mpBtnNew->setText("Apply");
        mpBtnNew->setToolTip("Apply the current parameters to the model.");

        // The break statement is intentionally missing

      default:
        CQNotes* pNotes = new CQNotes(mpTabWidget);
        mPages.push_back(pNotes);
        mpTabWidget->addTab(pNotes, "Notes");

        connect(this, SIGNAL(newClicked()), pCopasiWidget, SLOT(slotBtnNew()));
        connect(this, SIGNAL(copyClicked()), pCopasiWidget, SLOT(slotBtnCopy()));
        connect(this, SIGNAL(deleteClicked()), pCopasiWidget, SLOT(slotBtnDelete()));
        connect(this, SIGNAL(copyClicked()), pNotes, SLOT(slotBtnCopy()));
        break;
    }

  CQMiriamWidget* pMIRIAMWidget = new CQMiriamWidget(mpTabWidget);
  mPages.push_back(pMIRIAMWidget);
  mpTabWidget->addTab(pMIRIAMWidget, "Annotation");
  connect(this, SIGNAL(copyClicked()), pMIRIAMWidget, SLOT(slotBtnCopy()));

  CQRDFTreeView* pRDFTreeView = new CQRDFTreeView(mpTabWidget);
  mPages.push_back(pRDFTreeView);
  mpTabWidget->addTab(pRDFTreeView, "RDF Browser");
}
Exemplo n.º 8
0
UserItemWidget::UserItemWidget(const QString& username)
: m_username(username)
{
    // subscribers can listen to loved tracks and personal tags.
    bool subscriber = false;
    {
        unicorn::UserSettings us;
        QVariant v = us.value(unicorn::UserSettings::subscriptionKey(), false);
        subscriber = v.toBool();
    }

    // todo: no reason username can't come from the model...
    QPushButton* del;
    QHBoxLayout* layout = new QHBoxLayout(this);
    layout->addWidget( m_image = new QLabel );

    QVBoxLayout* vlayout = new QVBoxLayout();
    vlayout->addWidget( m_label = new QLabel );
    vlayout->addWidget( m_combo = new QComboBox() );
    vlayout->addWidget( m_playlistCombo = new QComboBox() );
    vlayout->addWidget( m_tagCombo = new QComboBox() );
    m_playlistCombo->setVisible(false);
    m_tagCombo->setVisible(false);
    m_combo->addItem( "Library", RqlSource::User );
    if (subscriber) {
        m_combo->addItem( "Loved Tracks", RqlSource::Loved );
    } else {
        // would be nice to show the option in a disabled state.
        // how?
        // fixme.
    }
    m_combo->addItem( "Recommended", RqlSource::Rec );
    m_combo->addItem( "Neighbours", RqlSource::Neigh );
    connect(m_combo, SIGNAL(currentIndexChanged(int)), SLOT(onComboChanged(int)));
    connect(m_playlistCombo, SIGNAL(currentIndexChanged(int)), SLOT(onCombo2Changed(int)));
    connect(m_tagCombo, SIGNAL(currentIndexChanged(int)), SLOT(onCombo2Changed(int)));

    layout->addLayout( vlayout );
    layout->addWidget( del = new QPushButton("X"), 0, Qt::AlignRight );
    m_image->setObjectName( "userImage" );
    m_image->setProperty( "noImage", true );
    m_label->setText( username );
    connect(del, SIGNAL(clicked()), SIGNAL(deleteClicked()));

    if (subscriber) {
        connect(User(username).getPlaylists(), SIGNAL(finished()), SLOT(onGotPlaylists()));
        connect(User(username).getTopTags(), SIGNAL(finished()), SLOT(onGotTags()));
    }
}
Exemplo n.º 9
0
void RDMarkerWidget::buttonClickedData()
{
  if(mark_delete_mode) {
    mark_button->setOn(false);
    emit deleteClicked();
  }
  else {
    if(!mark_button->isOn()) {
      returnPressedData();
    }
    mark_button->setFlashingEnabled(mark_button->isOn());
    mark_edit->setReadOnly(!mark_button->isOn());
    emit selectionChanged();
  }
}
Exemplo n.º 10
0
int EventWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: deleteClicked(); break;
        case 1: changeSeleted((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        default: ;
        }
        _id -= 2;
    }
    return _id;
}
Exemplo n.º 11
0
bool CustomPriority::Create()
{
    if (!LoadWindowFromXML("schedule-ui.xml", "custompriority", this))
        return false;

    m_ruleList = dynamic_cast<MythUIButtonList *>(GetChild("rules"));
    m_clauseList = dynamic_cast<MythUIButtonList *>(GetChild("clauses"));

    m_prioritySpin = dynamic_cast<MythUISpinBox *>(GetChild("priority"));

    m_titleEdit = dynamic_cast<MythUITextEdit *>(GetChild("title"));
    m_descriptionEdit = dynamic_cast<MythUITextEdit *>(GetChild("description"));

    m_addButton = dynamic_cast<MythUIButton *>(GetChild("add"));
    m_installButton = dynamic_cast<MythUIButton *>(GetChild("install"));
    m_testButton = dynamic_cast<MythUIButton *>(GetChild("test"));
    m_deleteButton = dynamic_cast<MythUIButton *>(GetChild("delete"));
    m_cancelButton = dynamic_cast<MythUIButton *>(GetChild("cancel"));

    if (!m_ruleList || !m_clauseList || !m_prioritySpin || !m_titleEdit ||
        !m_descriptionEdit || !m_addButton || !m_installButton ||
        !m_testButton || !m_deleteButton || !m_cancelButton)
    {
        LOG(VB_GENERAL, LOG_ERR,
            "CustomPriority, theme is missing required elements");
        return false;
    }

    connect(m_ruleList, SIGNAL(itemSelected(MythUIButtonListItem *)),
                SLOT(ruleChanged(MythUIButtonListItem *)));

    connect(m_titleEdit, SIGNAL(valueChanged()), SLOT(textChanged()));
    m_titleEdit->SetMaxLength(128);
    connect(m_descriptionEdit, SIGNAL(valueChanged()), SLOT(textChanged()));
    m_descriptionEdit->SetMaxLength(0);

    connect(m_addButton, SIGNAL(Clicked()), SLOT(addClicked()));
    connect(m_testButton, SIGNAL(Clicked()), SLOT(testClicked()));
    connect(m_installButton, SIGNAL(Clicked()), SLOT(installClicked()));
    connect(m_deleteButton, SIGNAL(Clicked()), SLOT(deleteClicked()));
    connect(m_cancelButton, SIGNAL(Clicked()), SLOT(Close()));

    loadData();

    BuildFocusList();

    return true;
}
Exemplo n.º 12
0
Upload::Upload(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Upload)
{
    ui->setupUi(this);

    ui->immediatleyButton->setChecked(true);

    connect(ui->addButton, SIGNAL(clicked()), this, SLOT(addClicked()));
    connect(ui->deleteButton, SIGNAL(clicked()), this, SLOT(deleteClicked()));
    connect(ui->transmitButton, SIGNAL(clicked()), this, SLOT(transmitClicked()));
    connect(this, SIGNAL(removeFiles(QString, QStringList)), parentWidget(), SLOT(removeFiles(QString, QStringList)));
    connect(this, SIGNAL(uploadFiles(QString, QStringList)), parentWidget(), SLOT(uploadFiles(QString, QStringList)));

    fileSizeMap.clear();
}
Exemplo n.º 13
0
void ConfigDocument::addRow(QString key, QString value)
{
    QHBoxLayout* layout = new QHBoxLayout();
    NoScrollCombo* keyEdit = new NoScrollCombo(this);
    QLineEdit* valueEdit = new QLineEdit(value, this);
    QPushButton* delButton = new QPushButton(tr("-"), this);
    QLabel* label = new QLabel(":");

    /* Loading the combo box options */
    keyEdit->setInsertPolicy(QComboBox::InsertAlphabetically);
    keyEdit->setEditable(true);
    keyEdit->addItems(primaryKeys);
    keyEdit->insertSeparator(keyEdit->count());
    keyEdit->addItems(secondaryKeys);
    if(keyEdit->findText(key) != -1)
        keyEdit->setCurrentIndex(keyEdit->findText(key));
    else
        keyEdit->setEditText(key);


    layout->addWidget(keyEdit);
    layout->addWidget(label);
    layout->addWidget(valueEdit);
    layout->addWidget(delButton);

    delButton->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
    delButton->setMaximumWidth(35);

    QObject::connect(delButton, SIGNAL(clicked()),
                     this, SLOT(deleteClicked()));
    QObject::connect(keyEdit, SIGNAL(currentIndexChanged(QString)),
                     this, SLOT(boxesChanged()));
    QObject::connect(keyEdit, SIGNAL(textChanged(QString)),
                     this, SLOT(boxesChanged()));
    QObject::connect(valueEdit, SIGNAL(textChanged(QString)),
                     this, SLOT(boxesChanged()));

    ui->configBoxes->addLayout(layout);

    containers.append(layout);
    keys.append(keyEdit);
    values.append(valueEdit);
    deleteButtons.append(delButton);
    labels.append(label);

}
Exemplo n.º 14
0
LayerManager::LayerManager(Score* s, QWidget* parent)
   : QDialog(parent)
      {
      setObjectName("LayerManager");
      setupUi(this);
      setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);

      score = s;

      for (int i = 0; i < 31; ++i) {
            QTableWidgetItem* item = new QTableWidgetItem(score->layerTags()[i+1]);
            tags->setItem(i, 0, item);
            item = new QTableWidgetItem(score->layerTagComments()[i+1]);
            tags->setItem(i, 1, item);
            }

      layers->setRowCount(score->layer().size());
      int row = 0;
      foreach(const Layer& l, score->layer()) {
            QTableWidgetItem* item = new QTableWidgetItem(l.name);
            layers->setItem(row, 0, item);
            QString tagString;
            for (int i = 0; i < 31; ++i) {
                  uint mask = 1 << (i+1);
                  if (mask &  l.tags) {
                        if (!tagString.isEmpty())
                              tagString += ",";
                        tagString += tags->item(i, 0)->text();
                        }
                  }
            item = new QTableWidgetItem(tagString);
            layers->setItem(row, 1, item);
            ++row;
            }
      layers->setCurrentCell(score->currentLayer(), 0);

      connect(createButton, SIGNAL(clicked()), SLOT(createClicked()));
      connect(deleteButton, SIGNAL(clicked()), SLOT(deleteClicked()));
      connect(addTagButton, SIGNAL(clicked()), SLOT(addTagClicked()));
      connect(deleteTagButton, SIGNAL(clicked()), SLOT(deleteTagClicked()));

      MuseScore::restoreGeometry(this);
      }
ManageTeachersWidget::ManageTeachersWidget(MainController *mainController, QWidget *parent) :
		QWidget(parent),
		m_ui(new Ui::ManageTeachersWidget),
		m_mainController(mainController),
		m_schoolDatabase(mainController->schoolData()->schoolDatabase())

{
	m_ui->setupUi(this);

	m_selectTeacherWidget = new SelectTeacherWidget(this);
	m_ui->verticalLayout->insertWidget(0, m_selectTeacherWidget);
	m_selectTeacherWidget->setTeacherTableModel(m_mainController->teacherTableModel());
	m_selectTeacherWidget->teacherTable()->
			hideColumn(TeacherTableModel::TeacherSelected);

	connect(m_ui->addTeacherButton, SIGNAL(clicked()), this, SLOT(addClicked()));
	connect(m_ui->editTeacherButton, SIGNAL(clicked()), this, SLOT(editClicked()));
	connect(m_ui->deleteTeacherButton, SIGNAL(clicked()), this, SLOT(deleteClicked()));
	connect(m_selectTeacherWidget->teacherTable()->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(setEditButtons()));

	setEditButtons();
}
Exemplo n.º 16
0
CQTabWidget::CQTabWidget(const ListViews::ObjectType & objectType, CopasiWidget * pCopasiWidget,
                         QWidget * parent, Qt::WindowFlags f) :
  CopasiWidget(parent, NULL, f),
  mPages(),
  mObjectType(objectType),
  mIgnoreLeave(false)
{
  setupUi(this);

  mpLblName->setText("<h3>" + FROM_UTF8(ListViews::ObjectTypeName[mObjectType]) + "</h3>");

  mpTabWidget->addTab(pCopasiWidget, "Details");
  mPages.push_back(pCopasiWidget);

  switch (mObjectType)
    {
      case  ListViews::ObjectType::MODEL:
        mpBtnNew->hide();
        mpBtnCopy->hide();
        mpBtnDelete->hide();
        break;

      case ListViews::ObjectType::MODELPARAMETERSET:
        mpBtnNew->setText("Apply");
        mpBtnNew->setToolTip("Apply the current parameters to the model.");

      // The break statement is intentionally missing

      default:
        CQNotes* pNotes = new CQNotes(mpTabWidget);
        mPages.push_back(pNotes);
        mpTabWidget->addTab(pNotes, "Notes");

        connect(this, SIGNAL(newClicked()), pCopasiWidget, SLOT(slotBtnNew()));
        connect(this, SIGNAL(copyClicked()), pCopasiWidget, SLOT(slotBtnCopy()));
        connect(this, SIGNAL(deleteClicked()), pCopasiWidget, SLOT(slotBtnDelete()));
        connect(this, SIGNAL(copyClicked()), pNotes, SLOT(slotBtnCopy()));
        break;
    }

  CQMiriamWidget* pMIRIAMWidget = new CQMiriamWidget(mpTabWidget);
  mPages.push_back(pMIRIAMWidget);
  mpTabWidget->addTab(pMIRIAMWidget, "Annotation");
  connect(this, SIGNAL(copyClicked()), pMIRIAMWidget, SLOT(slotBtnCopy()));

  CQRDFTreeView* pRDFTreeView = new CQRDFTreeView(mpTabWidget);
  mPages.push_back(pRDFTreeView);
  mpTabWidget->addTab(pRDFTreeView, "RDF Browser");

#ifdef COPASI_Provenance

  if ((FROM_UTF8(ListViews::ObjectTypeName[mObjectType]) == "Species") || (FROM_UTF8(ListViews::ObjectTypeName[mObjectType]) == "Compartment") || (FROM_UTF8(ListViews::ObjectTypeName[mObjectType]) == "Reaction") || (FROM_UTF8(ListViews::ObjectTypeName[mObjectType]) == "Event") || (FROM_UTF8(ListViews::ObjectTypeName[mObjectType]) == "Global Quantity"))
    {
      //FROM_UTF8(mpObject->getObjectName())
      //mpEntityProvenanceDialog = new CEntityProvenanceDialog(mpTabWidget, mpUndoStack, metaObject()->, pWindow->getVersionHierarchy()->getPathFile(), pWindow->getVersionHierarchy()->getVersionsPathToCurrentModel(),  pWindow->getProvenanceParentOfCurrentVersion(), pWindow->getVersionHierarchy()->getParentOfCurrentModel());
      mpEntityProvenanceDialog = new CEntityProvenanceDialog(mpTabWidget);
      mPathFile = pWindow->getVersionHierarchy()->getPathFile();
      mVersionPathToCurrentModel = pWindow->getVersionHierarchy()->getVersionsPathToCurrentModel();
      mPages.push_back(mpEntityProvenanceDialog);
      mpTabWidget->addTab(mpEntityProvenanceDialog, "Provenance");
      //connect(this, SIGNAL(activated()), this, SLOT(mpEntityProvenanceDialog->exec()));
      //connect(this, SIGNAL(),EntityProvenanceDialog ,SLOT(EntityProvenanceDialog->exec()));
    }

#endif
}
Exemplo n.º 17
0
void CQTabWidget::slotBtnDelete()
{
  mIgnoreLeave = true;
  emit deleteClicked();
  mIgnoreLeave = false;
}
Exemplo n.º 18
0
CustInfo::CustInfo(QWidget *pParent, const char *name) :
  QWidget(pParent, name)
{
//  Create and place the component Widgets
  QHBoxLayout *layoutMain = new QHBoxLayout(this, 0, 6, "layoutMain"); 
  QHBoxLayout *layoutNumber = new QHBoxLayout(0, 0, 6, "layoutNumber"); 
  QHBoxLayout *layoutButtons = new QHBoxLayout(0, 0, -1, "layoutButtons"); 

  _customerNumberLit = new QLabel(tr("Customer #:"), this, "_customerNumberLit");
  _customerNumberLit->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
  layoutNumber->addWidget(_customerNumberLit);

  _customerNumber = new CLineEdit(this, "_customerNumber");
  _customerNumber->setMinimumWidth(100);
  layoutNumber->addWidget(_customerNumber);
  
  _customerNumberEdit = new XLineEdit(this, "_customerNumberEdit");
  _customerNumberEdit->setMinimumWidth(100);
  _customerNumberEdit->setMaximumWidth(100);
  layoutNumber->addWidget(_customerNumberEdit);
  _customerNumberEdit->hide();
  layoutMain->addLayout(layoutNumber);

  _list = new QPushButton(tr("..."), this, "_list");
  _list->setFocusPolicy(Qt::NoFocus);
  if(_x_preferences)
  {
    if(_x_preferences->value("DefaultEllipsesAction") == "search")
      _list->setToolTip(tr("Search"));
    else
      _list->setToolTip(tr("List"));
  }
  layoutButtons->addWidget(_list);

  _info = new QPushButton(tr("?"), this, "_info");
  _info->setFocusPolicy(Qt::NoFocus);
  _info->setToolTip(tr("Open"));
  layoutButtons->addWidget(_info);
  
  _delete = new QPushButton(tr("x"), this, "_delete");
  _delete->setFocusPolicy(Qt::NoFocus);
  _delete->setToolTip(tr("Delete"));
  layoutButtons->addWidget(_delete);
  
  _new = new QPushButton(tr("+"), this, "_new");
  _new->setFocusPolicy(Qt::NoFocus);
  _new->setToolTip(tr("New"));
  layoutButtons->addWidget(_new);

  _edit = new QPushButton(tr("!"), this, "_edit");
  _edit->setFocusPolicy(Qt::NoFocus);
  _edit->setCheckable(true);
  _edit->setToolTip(tr("Edit Mode"));
  layoutButtons->addWidget(_edit);
  
#ifndef Q_WS_MAC
  _list->setMaximumWidth(25);
  _info->setMaximumWidth(25);
  _new->setMaximumWidth(25);
  _edit->setMaximumWidth(25);
  _delete->setMaximumWidth(25);
#else
  _list->setMinimumWidth(60);
  _list->setMinimumHeight(32);
  _info->setMinimumWidth(60);
  _info->setMinimumHeight(32);
  _new->setMinimumWidth(60);
  _new->setMinimumHeight(32);
  _edit->setMinimumWidth(60);
  _edit->setMinimumHeight(32);
  _delete->setMinimumWidth(60);
  _delete->setMinimumHeight(32);
  layoutNumber->setContentsMargins(2,0,0,0);
  layoutButtons->setContentsMargins(0,8,0,0);
  layoutButtons->setSpacing(6);
#endif
  
  layoutMain->addLayout(layoutButtons);

//  Make some internal connections
  connect(_list, SIGNAL(clicked()), _customerNumber, SLOT(sEllipses()));
  connect(_info, SIGNAL(clicked()), this, SLOT(sInfo()));

  connect(_customerNumber, SIGNAL(newId(int)), this, SIGNAL(newId(int)));
  connect(_customerNumber, SIGNAL(custNameChanged(const QString &)), this, SIGNAL(nameChanged(const QString &)));
  connect(_customerNumber, SIGNAL(custAddr1Changed(const QString &)), this, SIGNAL(address1Changed(const QString &)));
  connect(_customerNumber, SIGNAL(custAddr2Changed(const QString &)), this, SIGNAL(address2Changed(const QString &)));
  connect(_customerNumber, SIGNAL(custAddr3Changed(const QString &)), this, SIGNAL(address3Changed(const QString &)));
  connect(_customerNumber, SIGNAL(custCityChanged(const QString &)), this, SIGNAL(cityChanged(const QString &)));
  connect(_customerNumber, SIGNAL(custStateChanged(const QString &)), this, SIGNAL(stateChanged(const QString &)));
  connect(_customerNumber, SIGNAL(custZipCodeChanged(const QString &)), this, SIGNAL(zipCodeChanged(const QString &)));
  connect(_customerNumber, SIGNAL(custCountryChanged(const QString &)), this, SIGNAL(countryChanged(const QString &)));
  connect(_customerNumber, SIGNAL(custAddressChanged(const int)), this, SIGNAL(addressChanged(const int)));
  connect(_customerNumber, SIGNAL(custContactChanged(const int)), this, SIGNAL(contactChanged(const int)));
  connect(_customerNumber, SIGNAL(valid(bool)), this, SIGNAL(valid(bool)));

  connect(_customerNumber, SIGNAL(creditStatusChanged(const QString &)), this, SLOT(sHandleCreditStatus(const QString &)));
  connect(_customerNumber, SIGNAL(textChanged(const QString &)), _customerNumberEdit, SLOT(setText(const QString &)));
  connect(_customerNumberEdit, SIGNAL(editingFinished()), this, SIGNAL(editingFinished()));
  connect(_edit, SIGNAL(clicked()), this, SLOT(setMode()));
  connect(_new, SIGNAL(clicked()), this, SLOT(sNewClicked()));
  connect(_delete, SIGNAL(clicked()), this, SIGNAL(deleteClicked()));
  connect(_customerNumber, SIGNAL(newId(int)), this, SLOT(setMode()));

  if(_x_privileges && (!_x_privileges->check("MaintainCustomerMasters") && !_x_privileges->check("ViewCustomerMasters")))
  {
    _info->setEnabled(false);
    _delete->setEnabled(false);
    _edit->setEnabled(false);
    _new->setEnabled(false);
  }
  else
  {
    connect(_customerNumber, SIGNAL(valid(bool)), _info, SLOT(setEnabled(bool)));
    connect(_customerNumber, SIGNAL(requestInfo()), this, SLOT(sInfo()));
  }
  
  if(_x_privileges && (!_x_privileges->check("MaintainCustomerMasters") ))
  {
    _delete->setEnabled(false);
    _edit->setEnabled(false);
    _new->setEnabled(false);
  }

  setFocusProxy(_customerNumber);

  _mapper = new XDataWidgetMapper(this);
  _labelVisible = true;
  _canEdit=true;
  setCanEdit(false);
}
void ListWidgetButtonContainer::setButtons(const RecordItNow::CollectionListWidget::ButtonCodes &buttons)
{

    m_buttons.clear();

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->setContentsMargins(-1, -1, -1, 0);
    mainLayout->setSizeConstraint(QVBoxLayout::SetMinimumSize);

    KSeparator *mainSeparator = new KSeparator(this);
    mainSeparator->setFrameShape(KSeparator::HLine);

    QHBoxLayout *layout = new QHBoxLayout;
    layout->setContentsMargins(0, 0, 0, 0);
    layout->setSizeConstraint(QLayout::SetMinimumSize);

    mainLayout->addLayout(layout);
    mainLayout->addWidget(mainSeparator);

    QToolButton *button = 0;
    if (buttons & CollectionListWidget::PlayButton) {
        button = newButton(this);
        button->setIcon(KIcon("media-playback-start"));
        button->setToolTip(i18n("Play"));
        connect(button, SIGNAL(clicked()), this, SIGNAL(playClicked()));

        layout->addWidget(button);
        m_buttons.insert(CollectionListWidget::PlayButton, button);
    }
/*
    if (button) {
        KSeparator *separator = new KSeparator(this);
        separator->setFrameShape(QFrame::VLine);
        layout->addWidget(separator);
    }
*/

    if (buttons & CollectionListWidget::UploadButton) {
        button = newButton(this);
        button->setIcon(KIcon("recorditnow-upload-media"));
        button->setToolTip(i18n("Upload"));
        connect(button, SIGNAL(clicked()), this, SIGNAL(uploadClicked()));

        layout->addWidget(button);
        m_buttons.insert(CollectionListWidget::UploadButton, button);
    }

    if (buttons & CollectionListWidget::AddButton) {
        button = newButton(this);
        button->setIcon(KIcon("list-add"));
        button->setToolTip(i18n("Add"));
        connect(button, SIGNAL(clicked()), this, SIGNAL(addClicked()));

        layout->addWidget(button);
        m_buttons.insert(CollectionListWidget::AddButton, button);
    }

    if (buttons & CollectionListWidget::EditButton) {
        button = newButton(this);
        button->setIcon(KIcon("document-edit"));
        button->setToolTip(i18n("Edit"));
        connect(button, SIGNAL(clicked()), this, SIGNAL(editClicked()));

        layout->addWidget(button);
        m_buttons.insert(CollectionListWidget::EditButton, button);
    }

    if (buttons & CollectionListWidget::DeleteButton) {
        button = newButton(this);
        button->setIcon(KIcon("edit-delete"));
        button->setToolTip(i18n("Delete"));
        connect(button, SIGNAL(clicked()), this, SIGNAL(deleteClicked()));

        layout->addWidget(button);
        m_buttons.insert(CollectionListWidget::DeleteButton, button);
    }

    QWidget *spacer = new QWidget(this);
    spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
    layout->addWidget(spacer);

    setLayout(mainLayout);

}
Exemplo n.º 20
0
QgsBookmarks::QgsBookmarks( QWidget *parent )
    : QgsDockWidget( parent )
    , mQgisModel( nullptr )
    , mProjectModel( nullptr )
{
  setupUi( this );
  restorePosition();

  bookmarksDockContents->layout()->setMargin( 0 );
  bookmarksDockContents->layout()->setContentsMargins( 0, 0, 0, 0 );
  static_cast< QGridLayout* >( bookmarksDockContents->layout() )->setVerticalSpacing( 0 );

  QToolButton* btnImpExp = new QToolButton;
  btnImpExp->setAutoRaise( true );
  btnImpExp->setToolTip( tr( "Import/Export Bookmarks" ) );
  btnImpExp->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionSharing.svg" ) ) );
  btnImpExp->setPopupMode( QToolButton::InstantPopup );

  QMenu *share = new QMenu( this );
  QAction *btnExport = share->addAction( tr( "&Export" ) );
  QAction *btnImport = share->addAction( tr( "&Import" ) );
  btnExport->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionSharingExport.svg" ) ) );
  btnImport->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionSharingImport.svg" ) ) );
  connect( btnExport, SIGNAL( triggered() ), this, SLOT( exportToXml() ) );
  connect( btnImport, SIGNAL( triggered() ), this, SLOT( importFromXml() ) );
  btnImpExp->setMenu( share );

  connect( actionAdd, SIGNAL( triggered() ), this, SLOT( addClicked() ) );
  connect( actionDelete, SIGNAL( triggered() ), this, SLOT( deleteClicked() ) );
  connect( actionZoomTo, SIGNAL( triggered() ), this, SLOT( zoomToBookmark() ) );

  mBookmarkToolbar->addWidget( btnImpExp );

  // open the database
  QSqlDatabase db = QSqlDatabase::addDatabase( QStringLiteral( "QSQLITE" ), QStringLiteral( "bookmarks" ) );
  db.setDatabaseName( QgsApplication::qgisUserDbFilePath() );
  if ( !db.open() )
  {
    QMessageBox::warning( this, tr( "Error" ),
                          tr( "Unable to open bookmarks database.\nDatabase: %1\nDriver: %2\nDatabase: %3" )
                          .arg( QgsApplication::qgisUserDbFilePath(),
                                db.lastError().driverText(),
                                db.lastError().databaseText() )
                        );
    deleteLater();
    return;
  }

  mQgisModel = new QSqlTableModel( this, db );
  mQgisModel->setTable( QStringLiteral( "tbl_bookmarks" ) );
  mQgisModel->setSort( 0, Qt::AscendingOrder );
  mQgisModel->select();
  mQgisModel->setEditStrategy( QSqlTableModel::OnFieldChange );

  // set better headers then column names from table
  mQgisModel->setHeaderData( 0, Qt::Horizontal, tr( "ID" ) );
  mQgisModel->setHeaderData( 1, Qt::Horizontal, tr( "Name" ) );
  mQgisModel->setHeaderData( 2, Qt::Horizontal, tr( "Project" ) );
  mQgisModel->setHeaderData( 3, Qt::Horizontal, tr( "xMin" ) );
  mQgisModel->setHeaderData( 4, Qt::Horizontal, tr( "yMin" ) );
  mQgisModel->setHeaderData( 5, Qt::Horizontal, tr( "xMax" ) );
  mQgisModel->setHeaderData( 6, Qt::Horizontal, tr( "yMax" ) );
  mQgisModel->setHeaderData( 7, Qt::Horizontal, tr( "SRID" ) );

  mProjectModel = new QgsProjectBookmarksTableModel();
  mModel.reset( new QgsMergedBookmarksTableModel( *mQgisModel, *mProjectModel, lstBookmarks ) );

  lstBookmarks->setModel( mModel.data() );

  QSettings settings;
  lstBookmarks->header()->restoreState( settings.value( QStringLiteral( "/Windows/Bookmarks/headerstate" ) ).toByteArray() );

#ifndef QGISDEBUG
  lstBookmarks->setColumnHidden( 0, true );
#endif
}
Exemplo n.º 21
0
AngleDialog::AngleDialog(MyApp *app, QWidget *parent): QDialog(parent)
{
    int width, i;
    mParamsOpen = true;
    mApp = app;
    setWindowTitle(tr("Angle Range & Tile Selection"));
    mDefocusLabel = new QLabel(tr("E&xpected defocus (um): "), this);
    mDefocusEdit = new QLineEdit("6.0", this);

    // Buddy means the accelerator key for the label sets focus to the text box
    // This is meaningless if there is no unique & included in the label!
    mDefocusLabel->setBuddy(mDefocusEdit);
    mDefocusEdit->setFixedWidth(fontMetrics().width("    99.99"));
    mDefocusEdit->setToolTip("Nominal defocus value in microns");

    mLowAngleLabel = new QLabel(tr("Starti&ng tilt angle: "), this);
    mLowAngleEdit = new QLineEdit(tr("-90.0"), this);
    mLowAngleLabel->setBuddy(mLowAngleEdit);
    mLowAngleEdit->setToolTip("Tilt angle at negative end of range to include in fit");

    mHighAngleLabel = new QLabel(tr("Endin&g tilt angle:  "), this);
    mHighAngleEdit = new QLineEdit(tr("90.0"), this);
    mHighAngleLabel->setBuddy(mHighAngleEdit);
    mHighAngleEdit->setToolTip("Tilt angle at positive end of range to include in fit");

    mStepUpButton = new QPushButton( tr("Step &Up"), this);
    mStepUpButton->setToolTip("Increase starting and ending angles by the step");

    mStepDownButton = new QPushButton( tr("Step &Down"), this);
    mStepDownButton->setToolTip("Decrease starting and ending angles by the step");
    width = (int)(1.35 * mStepDownButton->fontMetrics().width("Step Down") + 0.5);
    mStepDownButton->setFixedWidth(width);
    mStepUpButton->setFixedWidth(width);

    mAutofitButton = new QPushButton(mApp->getFitSingleViews() ?
                                     tr("Autofit A&ll Single Views") :
                                     tr("Autofit A&ll Steps"), this);
    mAutofitButton->setEnabled(false);
    mAutofitButton->setToolTip("Fit to all tilt angle ranges that fit within limits below");

    mRangeStepLabel = new QLabel(tr("Ste&p angle range by:  "), this);
    mRangeStepEdit = new QLineEdit(tr("90.0"), this);
    mRangeStepLabel->setBuddy(mRangeStepEdit);
    mRangeStepEdit->setToolTip("Amount to change starting and ending tilt angles with the"
                               " Step buttons");

    mAutoFromLabel = new QLabel(tr("Autof&it: "), this);
    mAutoFromEdit = new QLineEdit(tr("90.0"), this);
    mAutoFromLabel->setBuddy(mAutoFromEdit);
    mAutoFromEdit->setToolTip("Starting angle of range to cover with autofitting to "
                              "stepped ranges");
    width = mAutoFromEdit->fontMetrics().width("   -99.99");
    mAutoFromEdit->setFixedWidth(width);

    mAutoToLabel = new QLabel(tr("t&o"), this);
    mAutoToEdit = new QLineEdit(tr("90.0"), this);
    mAutoToEdit->setFixedWidth(width);
    mAutoToLabel->setBuddy(mAutoToEdit);
    mAutoToEdit->setToolTip("Ending angle of range to cover with autofitting to "
                            "stepped ranges");

    mFitSingleBox = new QCheckBox(tr("Fit each view separately"), this);
    mFitSingleBox->setToolTip("Fit every view in the range separately");
    mFitSingleBox->setChecked(mApp->getFitSingleViews());

    QFrame *line = new QFrame(this);
    line->setFrameShape( QFrame::HLine );
    line->setFrameShadow( QFrame::Sunken );

    QFrame *line2 = new QFrame(this);
    line2->setFrameShape( QFrame::HLine );
    line2->setFrameShadow( QFrame::Sunken );

    QFrame *line3 = new QFrame(this);
    line3->setFrameShape( QFrame::HLine );
    line3->setFrameShadow( QFrame::Sunken );

    mTileParamButton = new QPushButton("+", this);
    width = mTileParamButton->fontMetrics().width(" + ");
    mTileParamButton->setFixedWidth(width);
    mTileParamButton->setFixedHeight(width);
    QLabel *tileParamLabel = new QLabel(tr("Tile parameters"), this);

    mDefTolLabel = new QLabel(tr("Center defocus tol (nm)"), this);
    mDefTolEdit = new QLineEdit(tr("200"), this);
    mDefTolLabel->setBuddy(mDefTolEdit);
    mDefTolEdit->setMinimumWidth(fontMetrics().width(" 9999"));
    mDefTolEdit->setToolTip("Maximum defocus difference for central tiles");

    mLeftTolLabel = new QLabel(tr("Left defocus tol (nm)"), this);
    mLeftTolEdit = new QLineEdit(tr("200"), this);
    mLeftTolLabel->setBuddy(mLeftTolEdit);
    mLeftTolEdit->setToolTip("Maximum defocus difference for non-central tiles on left");

    mRightTolLabel = new QLabel(tr("Right defocus tol (nm)"), this);
    mRightTolEdit = new QLineEdit(tr("200"), this);
    mRightTolLabel->setBuddy(mRightTolEdit);
    mRightTolEdit->setToolTip("Maximum defocus difference for non-central tiles on right");

    mTileSizeLabel = new QLabel(tr("Tile size:           "), this);
    mTileSizeEdit = new QLineEdit(tr("256"),this);
    mTileSizeLabel->setBuddy(mTileSizeEdit);
    mTileSizeEdit->setToolTip("Size of square, overlapping tiles to analyze");

    mAxisAngleLabel = new QLabel(tr("Tilt axis angle:   "), this);
    mAxisAngleEdit = new QLineEdit( tr("0.0"), this);
    mAxisAngleLabel->setBuddy(mAxisAngleEdit);
    mAxisAngleEdit->setToolTip("Angle of tilt axis from vertical");

    mDefocusGroup = new QGroupBox(tr("Which defocus to use"), this);
    QButtonGroup *butGroup = new QButtonGroup(this);
    mExpDefocusRadio = new QRadioButton(tr("Expected defocus"));
    mExpDefocusRadio->setToolTip("Use expected defocus for shifting spectra "
                                 "from off-center tiles");
    mCurrDefocusRadio = new QRadioButton(tr("Current defocus estimate"));
    mCurrDefocusRadio->setToolTip("Use current defocus estimate for shifting "
                                  "spectra from off-center tiles");
    if (mApp->getDefocusOption())
        mCurrDefocusRadio->setChecked(true);
    else
        mExpDefocusRadio->setChecked(true);
    butGroup->addButton(mExpDefocusRadio);
    butGroup->addButton(mCurrDefocusRadio);

    QVBoxLayout *vbox = new QVBoxLayout;
    vbox->addWidget(mExpDefocusRadio);
    vbox->addWidget(mCurrDefocusRadio);
    mDefocusGroup->setLayout(vbox);

    // This is what I usually do for more compact group boxes
    vbox->setSpacing(0);
    vbox->setContentsMargins(5, 2, 5, 5);

    mIfAllGroup = new QGroupBox(tr("Initial tiles to include"), this);
    butGroup = new QButtonGroup(this);
    mOnlyCenterRadio = new QRadioButton(tr("Only central tiles"));
    mAllAtOnceRadio = new QRadioButton(tr("All tiles"));
    mOnlyCenterRadio->setToolTip("Compute curve initially only from central "
                                 "tiles");
    mAllAtOnceRadio->setToolTip("Compute curve using all available tiles");
    if (mApp->getInitTileOption())
        mAllAtOnceRadio->setChecked(true);
    else
        mOnlyCenterRadio->setChecked(true);
    butGroup->addButton(mAllAtOnceRadio);
    butGroup->addButton(mOnlyCenterRadio);

    QVBoxLayout *vbox2 = new QVBoxLayout;
    vbox2->addWidget(mOnlyCenterRadio);
    vbox2->addWidget(mAllAtOnceRadio);
    mIfAllGroup->setLayout(vbox2);
    vbox2->setSpacing(0);
    vbox2->setContentsMargins(5, 2, 5, 5);

    mSaveButton = new QPushButton( tr("&Store Defocus in Table"), this);
    mSaveButton->setEnabled(true);
    mSaveButton->setToolTip("Add current defocus value to table below");

    mApplyButton = new QPushButton( tr("&Apply"), this);
    mApplyButton->setDefault(true);
    mApplyButton->setEnabled(false);
    mApplyButton->setToolTip("Compute power spectra with current settings");

    mCloseButton = new QPushButton( tr("&Close"), this);
    mCloseButton->setFixedWidth(3 * fontMetrics().width("Close"));
    mCloseButton->setToolTip("Close this dialog");

    mTable = new QTableWidget(0, 4, this);
    mTable->setSelectionBehavior(QAbstractItemView::SelectRows);
    mTable->setSelectionMode(QAbstractItemView::SingleSelection);
    mTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
    QStringList headers;
    headers << "Start" << "End" << "Middle" << "Defocus";
    mTable->setHorizontalHeaderLabels(headers);
    width = (int)(1.66 * mTable->fontMetrics().width("Defocus"));
    for (i = 0; i < 4; i++)
        mTable->setColumnWidth(i, width);

    mDeleteButton = new QPushButton( tr("Delete Row"), this);
    mReturnButton = new QPushButton( tr("Set &Tilt Angles"), this);
    mToFileButton = new QPushButton( tr("Sa&ve to File"), this);
    mDeleteButton->setToolTip("Remove this row from the table");
    mReturnButton->setToolTip("Set starting and ending angles from this row and "
                              "recompute spectrum");
    mToFileButton->setToolTip("Save angle and defocus values in table to file");
    mTileParamButton->setFocusPolicy(Qt::NoFocus);
    mStepUpButton->setFocusPolicy(Qt::NoFocus);
    mStepDownButton->setFocusPolicy(Qt::NoFocus);
    mAutofitButton->setFocusPolicy(Qt::NoFocus);
    mFitSingleBox->setFocusPolicy(Qt::NoFocus);
    mDeleteButton->setFocusPolicy(Qt::NoFocus);
    mReturnButton->setFocusPolicy(Qt::NoFocus);
    mToFileButton->setFocusPolicy(Qt::NoFocus);
    mSaveButton->setFocusPolicy(Qt::NoFocus);

    connect(mDefocusEdit, SIGNAL(textChanged(const QString &)), this,
            SLOT(enableApplyButton(const QString &)) );
    connect(mLowAngleEdit, SIGNAL(textChanged(const QString &)), this,
            SLOT(enableApplyButton(const QString &)) );
    connect(mLowAngleEdit, SIGNAL(textChanged(const QString &)), this,
            SLOT(enableApplyButton(const QString &)) );
    connect(mDefTolEdit, SIGNAL(textChanged(const QString &)), this,
            SLOT(enableApplyButton(const QString &)) );
    connect(mTileSizeEdit, SIGNAL(textChanged(const QString &)), this,
            SLOT(enableApplyButton(const QString &)) );
    connect(mAxisAngleEdit, SIGNAL(textChanged(const QString &)), this,
            SLOT(enableApplyButton(const QString &)) );
    connect(mLeftTolEdit, SIGNAL(textChanged(const QString &)), this,
            SLOT(enableApplyButton(const QString &)) );
    connect(mRightTolEdit, SIGNAL(textChanged(const QString &)), this,
            SLOT(enableApplyButton(const QString &)) );

    connect(mExpDefocusRadio, SIGNAL(clicked()), this, SLOT(expDefocusChecked()));
    connect(mCurrDefocusRadio, SIGNAL(clicked()),this, SLOT(currDefocusChecked()));
    connect(mOnlyCenterRadio, SIGNAL(clicked()), this, SLOT(onlyCenterChecked()));
    connect(mAllAtOnceRadio, SIGNAL(clicked()), this, SLOT(allAtOnceChecked()) );

    connect(mTileParamButton, SIGNAL(clicked()), this, SLOT(tileParamsClicked()) );
    connect(mApplyButton, SIGNAL(clicked()), this, SLOT(applyClicked()) );
    connect(mStepUpButton, SIGNAL(clicked()), this, SLOT(stepUpClicked()) );
    connect(mAutofitButton, SIGNAL(clicked()), this, SLOT(autofitClicked()) );
    connect(mStepDownButton, SIGNAL(clicked()), this, SLOT(stepDownClicked()) );
    connect(mFitSingleBox, SIGNAL(toggled(bool)), this, SLOT(fitSingleToggled(bool)));
    connect(mCloseButton, SIGNAL(clicked()), this, SLOT(close()) );
    connect(mSaveButton, SIGNAL(clicked()), mApp, SLOT(saveCurrentDefocus()) );
    connect(mDeleteButton, SIGNAL(clicked()), this, SLOT(deleteClicked()) );
    connect(mReturnButton, SIGNAL(clicked()), this, SLOT(setAnglesClicked()) );
    connect(mToFileButton, SIGNAL(clicked()), mApp, SLOT(writeDefocusFile()) );
    connect(mTable, SIGNAL(cellDoubleClicked(int, int)), this,
            SLOT(rowDoubleClicked(int, int)));

    QHBoxLayout *defHLayout = new QHBoxLayout;
    defHLayout->addWidget(mDefocusLabel);
    defHLayout->addWidget(mDefocusEdit);

    QHBoxLayout *defTolHLayout = new QHBoxLayout;
    defTolHLayout->addWidget(mDefTolLabel);
    defTolHLayout->addWidget(mDefTolEdit);

    QHBoxLayout *leftTolHLayout = new QHBoxLayout;
    leftTolHLayout->addWidget(mLeftTolLabel);
    leftTolHLayout->addWidget(mLeftTolEdit);

    QHBoxLayout *rightTolHLayout = new QHBoxLayout;
    rightTolHLayout->addWidget(mRightTolLabel);
    rightTolHLayout->addWidget(mRightTolEdit);

    QHBoxLayout *lAngleHLayout = new QHBoxLayout;
    lAngleHLayout->addWidget(mLowAngleLabel);
    lAngleHLayout->addWidget(mLowAngleEdit);

    QHBoxLayout *hAngleHLayout = new QHBoxLayout;
    hAngleHLayout->addWidget(mHighAngleLabel);
    hAngleHLayout->addWidget(mHighAngleEdit);

    QHBoxLayout *stepSizeHLayout = new QHBoxLayout;
    stepSizeHLayout->addWidget(mRangeStepLabel);
    stepSizeHLayout->addWidget(mRangeStepEdit);

    QHBoxLayout *stepButHLayout = new QHBoxLayout;
    stepButHLayout->addWidget(mStepUpButton);
    stepButHLayout->addWidget(mStepDownButton);

    QHBoxLayout *autoRangeHLayout = new QHBoxLayout;
    autoRangeHLayout->addWidget(mAutoFromLabel);
    autoRangeHLayout->addWidget(mAutoFromEdit);
    autoRangeHLayout->addWidget(mAutoToLabel);
    autoRangeHLayout->addWidget(mAutoToEdit);

    QHBoxLayout *tileParamHLayout = new QHBoxLayout;
    tileParamHLayout->addWidget(mTileParamButton);
    tileParamHLayout->addWidget(tileParamLabel);

    QHBoxLayout *tileSizeHLayout = new QHBoxLayout;
    tileSizeHLayout->addWidget(mTileSizeLabel);
    tileSizeHLayout->addWidget(mTileSizeEdit);

    QHBoxLayout *axisAngleHLayout = new QHBoxLayout;
    axisAngleHLayout->addWidget(mAxisAngleLabel);
    axisAngleHLayout->addWidget(mAxisAngleEdit);

    QHBoxLayout *bottomHLayout = new QHBoxLayout;
    bottomHLayout->addWidget(mCloseButton);

    QHBoxLayout *tabHLayout = new QHBoxLayout;
    tabHLayout->addWidget(mDeleteButton);
    tabHLayout->addWidget(mReturnButton);
    tabHLayout->addWidget(mToFileButton);

    QVBoxLayout *leftVLayout = new QVBoxLayout;
    leftVLayout->addLayout(lAngleHLayout);
    leftVLayout->addLayout(hAngleHLayout);
    leftVLayout->addWidget(line);
    leftVLayout->addLayout(stepSizeHLayout);
    leftVLayout->addLayout(stepButHLayout);
    leftVLayout->addWidget(line2);
    leftVLayout->addWidget(mAutofitButton);
    leftVLayout->addLayout(autoRangeHLayout);
    leftVLayout->addWidget(mFitSingleBox);
    leftVLayout->addWidget(line3);
    leftVLayout->addLayout(tileParamHLayout);
    leftVLayout->addLayout(defTolHLayout);
    leftVLayout->addLayout(leftTolHLayout);
    leftVLayout->addLayout(rightTolHLayout);

    QVBoxLayout *rightVLayout = new QVBoxLayout;
    rightVLayout->addLayout(defHLayout);
    rightVLayout->addWidget(mDefocusGroup);
    rightVLayout->addWidget(mIfAllGroup);
    rightVLayout->addWidget(mApplyButton);
    rightVLayout->addWidget(mSaveButton);
    rightVLayout->addStretch();
    rightVLayout->addLayout(tileSizeHLayout);
    rightVLayout->addLayout(axisAngleHLayout);

    QHBoxLayout *topHLayout = new QHBoxLayout;
    topHLayout->addLayout(leftVLayout);
    topHLayout->addLayout(rightVLayout);

    QVBoxLayout *mainVLayout = new QVBoxLayout(this);
    mainVLayout->addLayout(topHLayout);
    mainVLayout->addWidget(mTable);
    mainVLayout->setStretchFactor(mTable, 100);
    mainVLayout->addLayout(tabHLayout);
    mainVLayout->addLayout(bottomHLayout);
}
Exemplo n.º 22
0
void ChannelsJoinDialogTreeWidget::mousePressEvent(QMouseEvent *e)
{
	e->ignore();
	QTreeWidgetItem * it = itemAt(e->pos());
	ChannelsJoinDialog *pDialog = (ChannelsJoinDialog*) parentWidget();
	if(!it || !pDialog)
	{
		QTreeWidget::mousePressEvent(e);
		return;
	}

	setCurrentItem(it);

	if(it->type() == ChannelsJoinDialog::HeaderItem)
	{
		QTreeWidget::mousePressEvent(e);
		return;
	}

	if(e->button() & Qt::RightButton)
	{
		pDialog->itemSelected();
		if(!m_pJoinPopup)
		{
			m_pJoinPopup = new QMenu(this);
			m_pJoinPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Join)),__tr2qs("Join"),pDialog,SLOT(joinClicked()));
			m_pJoinPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Discard)),__tr2qs("Delete"),pDialog,SLOT(deleteClicked()));
		}

		m_pJoinPopup->popup(QCursor::pos());
	} else {
		pDialog->itemSelected();
	}
}
UserVariableOptionsWidget::UserVariableOptionsWidget(UserVariable* userVariable, QWidget *parent)
    : QWidget(parent)
    , userVariable(userVariable)
{
    QGridLayout *layout = new QGridLayout(this);
    layout->setColumnStretch(1, 1);
    setLayout(layout);

    QLabel *nameLabel = new QLabel(i18n("Name:"), this);
    nameLabel->setAlignment(Qt::AlignRight);
    layout->addWidget(nameLabel, 0, 0);
    QHBoxLayout *nameLayout = new QHBoxLayout();
    nameEdit = new QComboBox(this);
    nameEdit->setObjectName(QLatin1String("nameEdit"));
    nameEdit->setMinimumContentsLength(10);
    nameLabel->setBuddy(nameEdit);
    connect(nameEdit, SIGNAL(currentIndexChanged(QString)), this, SLOT(nameChanged()));
    nameLayout->addWidget(nameEdit);

    newButton = new QPushButton(i18n("New"), this);
    connect(newButton, SIGNAL(clicked()), this, SLOT(newClicked()));
    nameLayout->addWidget(newButton);

    deleteButton = new QPushButton(i18n("Delete"), this);
    deleteButton->setObjectName("DeleteButton");
    connect(deleteButton, SIGNAL(clicked()), this, SLOT(deleteClicked()));
    nameLayout->addWidget(deleteButton);

    layout->addLayout(nameLayout, 0, 1);

    QLabel *typeLabel = new QLabel(i18n("Format:"), this);
    typeLabel->setAlignment(Qt::AlignRight);
    layout->addWidget(typeLabel, 1, 0);
    typeEdit = new QComboBox(this);
    typeEdit->setObjectName(QLatin1String("typeEdit"));
    typeLabel->setBuddy(typeEdit);
    typeEdit->addItem(i18n("String"), QLatin1String("string"));
    typeEdit->addItem(i18n("Boolean"), QLatin1String("boolean"));
    typeEdit->addItem(i18n("Float"), QLatin1String("float"));
    typeEdit->addItem(i18n("Percentage"), QLatin1String("percentage"));
    typeEdit->addItem(i18n("Currency"), QLatin1String("currency"));
    typeEdit->addItem(i18n("Date"), QLatin1String("date"));
    typeEdit->addItem(i18n("Time"), QLatin1String("time"));
    typeEdit->addItem(i18n("Formula"), QLatin1String("formula"));
    typeEdit->addItem(i18n("Void"), QLatin1String("void"));
    typeEdit->setCurrentIndex(qMax(0, typeEdit->findData(variableManager()->userType(userVariable->name()))));
    connect(typeEdit, SIGNAL(currentIndexChanged(QString)), this, SLOT(typeChanged()));
    layout->addWidget(typeEdit, 1, 1);

    QLabel *valueLabel = new QLabel(i18n("Value:"), this);
    valueLabel->setAlignment(Qt::AlignRight);
    layout->addWidget(valueLabel, 2, 0);
    valueEdit = new QLineEdit(this);
    valueEdit->setObjectName(QLatin1String("valueEdit"));
    valueLabel->setBuddy(valueEdit);
    valueEdit->setText(variableManager()->value(userVariable->name()));
    connect(valueEdit, SIGNAL(textChanged(QString)), this, SLOT(valueChanged()));
    layout->addWidget(valueEdit, 2, 1);

    updateNameEdit();
}
Exemplo n.º 24
0
QgsBookmarks::QgsBookmarks( QWidget *parent, Qt::WindowFlags fl )
    : QDialog( parent, fl )
{
  setupUi( this );
  restorePosition();

  //
  // Create the zoomto and delete buttons and add them to the
  // toolbar
  //
  QPushButton *btnAdd    = new QPushButton( tr( "&Add" ) );
  QPushButton *btnDelete = new QPushButton( tr( "&Delete" ) );
  QPushButton *btnZoomTo = new QPushButton( tr( "&Zoom to" ) );
  QPushButton *btnImpExp = new QPushButton( tr( "&Share" ) );

  btnZoomTo->setDefault( true );
  buttonBox->addButton( btnAdd, QDialogButtonBox::ActionRole );
  buttonBox->addButton( btnDelete, QDialogButtonBox::ActionRole );
  buttonBox->addButton( btnZoomTo, QDialogButtonBox::ActionRole );
  buttonBox->addButton( btnImpExp, QDialogButtonBox::ActionRole );

  QMenu *share = new QMenu();
  QAction *btnExport = share->addAction( tr( "&Export" ) );
  QAction *btnImport = share->addAction( tr( "&Import" ) );
  connect( btnExport, SIGNAL( triggered() ), this, SLOT( exportToXML() ) );
  connect( btnImport, SIGNAL( triggered() ), this, SLOT( importFromXML() ) );
  btnImpExp->setMenu( share );

  connect( btnAdd, SIGNAL( clicked() ), this, SLOT( addClicked() ) );
  connect( btnDelete, SIGNAL( clicked() ), this, SLOT( deleteClicked() ) );
  connect( btnZoomTo, SIGNAL( clicked() ), this, SLOT( zoomToBookmark() ) );

  // open the database
  QSqlDatabase db = QSqlDatabase::addDatabase( "QSQLITE", "bookmarks" );
  db.setDatabaseName( QgsApplication::qgisUserDbFilePath() );
  if ( !db.open() )
  {
    QMessageBox::warning( this, tr( "Error" ),
                          tr( "Unable to open bookmarks database.\nDatabase: %1\nDriver: %2\nDatabase: %3" )
                          .arg( QgsApplication::qgisUserDbFilePath() )
                          .arg( db.lastError().driverText() )
                          .arg( db.lastError().databaseText() )
                        );
    deleteLater();
    return;
  }

  QSqlTableModel *model = new QSqlTableModel( this, db );
  model->setTable( "tbl_bookmarks" );
  model->setSort( 0, Qt::AscendingOrder );
  model->setEditStrategy( QSqlTableModel::OnFieldChange );
  model->select();

  // set better headers then column names from table
  model->setHeaderData( 0, Qt::Horizontal, tr( "ID" ) );
  model->setHeaderData( 1, Qt::Horizontal, tr( "Name" ) );
  model->setHeaderData( 2, Qt::Horizontal, tr( "Project" ) );
  model->setHeaderData( 3, Qt::Horizontal, tr( "xMin" ) );
  model->setHeaderData( 4, Qt::Horizontal, tr( "yMin" ) );
  model->setHeaderData( 5, Qt::Horizontal, tr( "xMax" ) );
  model->setHeaderData( 6, Qt::Horizontal, tr( "yMax" ) );
  model->setHeaderData( 7, Qt::Horizontal, tr( "SRID" ) );

  lstBookmarks->setModel( model );

  QSettings settings;
  lstBookmarks->header()->restoreState( settings.value( "/Windows/Bookmarks/headerstate" ).toByteArray() );

#ifndef QGISDEBUG
  lstBookmarks->setColumnHidden( 0, true );
#endif
}