예제 #1
0
/**
 * @brief widToolbar::widToolbar
 *        Default constructor for right column toolbar widget
 */
widToolbar::widToolbar(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::widToolbar)
{
    mComboPalette = 0;

    ui->setupUi(this);

    // Configure properties tables
    QTableWidget *tProp;
    tProp = ui->tabProperties;
    tProp->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
    // Configure config table
    tProp = ui->tabConfig;
    tProp->horizontalHeader()->setResizeMode(QHeaderView::Stretch);

    // Add a combobox into table for view selection
    mComboView = new QComboBox();
    ui->tabConfig->setCellWidget(ROW_VIEW, 1, mComboView);

    // Add a combobox into table for palette selection
    mComboPalette = new QComboBox();
    ui->tabConfig->setCellWidget(ROW_PALETTE, 1, mComboPalette);
    connect(mComboPalette, SIGNAL(currentIndexChanged(int)),
            this,          SLOT  (onPaletteSelected(int)));
}
예제 #2
0
InformationPanel::InformationPanel(QWidget *parent)
: ConfiguratorPanel(false, parent) {
	_name = "Information";
	_icon = QIcon(":/res/icons/info.png");
	setHeadline("Information");
	setDescription("System paths and variables");

	QVBoxLayout *l = new QVBoxLayout;
	l->setMargin(0);
	setLayout(l);

	QTableWidget *table = new QTableWidget;
	table->setFrameShape(QFrame::NoFrame);
	table->setColumnCount(2);
	table->verticalHeader()->setVisible(false);
	table->horizontalHeader()->setStretchLastSection(true);
	table->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
	table->setHorizontalHeaderLabels(QStringList() << "Name" << "Value");
	table->setAlternatingRowColors(true);
	table->setSelectionMode(QAbstractItemView::NoSelection);

	l->addWidget(table);

	Seiscomp::Environment *env = Seiscomp::Environment::Instance();
	addRow(table, "PATH", getenv("PATH"));
	addRow(table, "ROOTDIR", env->installDir().c_str());
	addRow(table, "DEFAULTCONFIGDIR", env->globalConfigDir().c_str());
	addRow(table, "SYSTEMCONFIGDIR", env->appConfigDir().c_str());
	addRow(table, "CONFIGDIR", env->configDir().c_str());
	addRow(table, "LOGDIR", env->logDir().c_str());
	addRow(table, "DATADIR", env->shareDir().c_str());

	table->resizeColumnsToContents();
}
void TrainLinePanel::__initTableHeader()
{
    int listLineCount = ui->listWidget->count();
    for(int i = 0; i < listLineCount;i++)
    {
        QTableWidget *tableWidget = new QTableWidget;
        tableWidget->setAlternatingRowColors(true);
        tableWidget->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
        tableWidget->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);

    //    connect(tableWidget,SIGNAL(doubleClicked(QModelIndex)),keyboard,SLOT(show(QModelIndex)));

        tableWidget->verticalHeader()->setHidden(true);


        tableWidget->setColumnCount(10);
        tableWidget->setColumnHidden(9,true);
        tableWidget->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
        tableWidget->horizontalHeader()->setMinimumHeight(30);
        tableWidget->horizontalHeader()->setMinimumSectionSize(140);
        QTableWidgetItem* item = new QTableWidgetItem("Station number");
        item->setTextAlignment(Qt::AlignHCenter);
        tableWidget->setHorizontalHeaderItem(0,item);
        item = new QTableWidgetItem("Station id");
        item->setTextAlignment(Qt::AlignHCenter);
        tableWidget->setHorizontalHeaderItem(1,item);
        item = new QTableWidgetItem("Name(EN)");
        item->setTextAlignment(Qt::AlignHCenter);
        tableWidget->setHorizontalHeaderItem(2,item);
        item = new QTableWidgetItem("Name(TH)");
        item->setTextAlignment(Qt::AlignHCenter);
        tableWidget->setHorizontalHeaderItem(3,item);
        item = new QTableWidgetItem("Start time");
        item->setTextAlignment(Qt::AlignHCenter);
        tableWidget->setHorizontalHeaderItem(4,item);
        item = new QTableWidgetItem("Arrive time");
        item->setTextAlignment(Qt::AlignHCenter);
        tableWidget->setHorizontalHeaderItem(5,item);

        item = new QTableWidgetItem("Lng");
        item->setTextAlignment(Qt::AlignHCenter);
        tableWidget->setHorizontalHeaderItem(6,item);

        item = new QTableWidgetItem("Lat");
        item->setTextAlignment(Qt::AlignHCenter);
        tableWidget->setHorizontalHeaderItem(7,item);

        item = new QTableWidgetItem("Sea level");
        item->setTextAlignment(Qt::AlignHCenter);
        tableWidget->setHorizontalHeaderItem(8,item);

        item = new QTableWidgetItem("Rowid");
        item->setTextAlignment(Qt::AlignHCenter);
        tableWidget->setHorizontalHeaderItem(9,item);

        ui->stackedWidget->addWidget(tableWidget);
    }
//    connect(tableWidget,SIGNAL(itemChanged(QTableWidgetItem*)),this,SLOT(updateDatabase(QTableWidgetItem*)));
}
QTableWidget *StManagerStudyListComp::createSeriesSelectionTable ()
{
  QTableWidget *seriesTable = new QTableWidget;

  seriesTable->setSelectionMode( QAbstractItemView::SingleSelection );
  seriesTable->setEditTriggers( QAbstractItemView::NoEditTriggers );
  seriesTable->setColumnCount( 1 );
  seriesTable->horizontalHeader()->setResizeMode( QHeaderView::Stretch );
  seriesTable->horizontalHeader()->hide();

  return seriesTable;
}
예제 #5
0
QWidget * Table::createQtWidget(Proxy *proxy, UIProxy *uiproxy, QWidget *parent)
{
    QTableWidget *tablewidget = new TableWidget(this, parent);
    tablewidget->setEnabled(enabled);
    tablewidget->setVisible(visible);
    tablewidget->setStyleSheet(QString::fromStdString(style));
    size_t rowcount = rows.size(), columncount = 0;
    for(size_t i = 0; i < rowcount; i++)
        columncount = std::max(columncount, rows[i].size());
    tablewidget->setRowCount(rowcount);
    tablewidget->setColumnCount(columncount);
    tablewidget->horizontalHeader()->setVisible(show_horizontal_header);
    tablewidget->verticalHeader()->setVisible(show_vertical_header);
    tablewidget->setShowGrid(show_grid);
    QStringList qtHorizontalHeader;
    for(size_t i = 0; i < horizontalHeader.size(); i++)
        qtHorizontalHeader << QString::fromStdString(horizontalHeader[i]);
    tablewidget->setHorizontalHeaderLabels(qtHorizontalHeader);
    QStringList qtVerticalHeader;
    for(size_t i = 0; i < verticalHeader.size(); i++)
        qtVerticalHeader << QString::fromStdString(verticalHeader[i]);
    tablewidget->setVerticalHeaderLabels(qtVerticalHeader);
    if(autosize_horizontal_header)
        tablewidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
    if(autosize_vertical_header)
        tablewidget->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
    if(sortable)
        tablewidget->setSortingEnabled(true);
    for(size_t row = 0; row < rowcount; row++)
    {
        for(size_t column = 0; column < rows[row].size(); column++)
        {
            TableItem &item = rows[row][column];
            QTableWidgetItem *qtwitem = new QTableWidgetItem(QString::fromStdString(item.text));
            if(item.editable)
                qtwitem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
            else
                qtwitem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
            tablewidget->setItem(row, column, qtwitem);
        }
    }
    tablewidget->setSelectionBehavior(selectionBehavior);
    tablewidget->setSelectionMode(selectionMode);
    QObject::connect(tablewidget, &QTableWidget::cellActivated, uiproxy, &UIProxy::onCellActivate);
    QObject::connect(tablewidget, &QTableWidget::cellChanged, uiproxy, &UIProxy::onCellActivate);
    QObject::connect(tablewidget, &QTableWidget::itemSelectionChanged, uiproxy, &UIProxy::onTableSelectionChange);
    setQWidget(tablewidget);
    setEditable(editable);
    setProxy(proxy);
    return tablewidget;
}
예제 #6
0
void MainWindow::elegantClose(bool quit) {
  qDebug() << "Exiting elegantly.";

  QSettings s;
  s.setValue("mainWindowGeometry", saveGeometry());
  s.setValue("mainWindowState", saveState());

  for (int i = 0; i < ui->listTabs->count(); i++) {
    QTableWidget *t = static_cast<QTableWidget *>(
        ui->listTabs->widget(i)->layout()->itemAt(0)->widget());

    QString key = ui->listTabs->tabText(i)
                      .replace(QRegExp("[ ]+"), "")
                      .replace(QRegExp("\\([0-9]+\\)"), "") +
                  "State";

    s.setValue(key, t->horizontalHeader()->saveState());
  }

  for (QFuture<void> f : this->async_registry) {
    if (f.isRunning()) {
      qApp->processEvents();
      f.waitForFinished();
    }
  }

  if (!quit) return;

  if (this->hasUser) {
    connect(User::sharedUser(), SIGNAL(quitFinished()), qApp, SLOT(quit()));
    User::sharedUser()->quit();
  } else {
    qApp->quit();
  }
}
예제 #7
0
ActivateModsDialog::ActivateModsDialog(const std::map<QString, std::vector<QString> > &missingPlugins, QWidget *parent)
  : TutorableDialog("ActivateMods", parent), ui(new Ui::ActivateModsDialog)
{
  ui->setupUi(this);

  QTableWidget *modsTable = findChild<QTableWidget*>("modsTable");
  QHeaderView *headerView = modsTable->horizontalHeader();
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
  headerView->setSectionResizeMode(0, QHeaderView::Stretch);
  headerView->setSectionResizeMode(1, QHeaderView::Interactive);
#else
  headerView->setResizeMode(0, QHeaderView::Stretch);
  headerView->setResizeMode(1, QHeaderView::Interactive);
#endif

  int row = 0;

  modsTable->setRowCount(missingPlugins.size());

  for (std::map<QString, std::vector<QString> >::const_iterator espIter = missingPlugins.begin();
       espIter != missingPlugins.end(); ++espIter, ++row) {
    modsTable->setCellWidget(row, 0, new QLabel(espIter->first));
    if (espIter->second.size() == 0) {
      modsTable->setCellWidget(row, 1, new QLabel(tr("not found")));
    } else {
      QComboBox* combo = new QComboBox();
      for (std::vector<QString>::const_iterator modIter = espIter->second.begin();
           modIter != espIter->second.end(); ++modIter) {
        combo->addItem(*modIter);
      }
      modsTable->setCellWidget(row, 1, combo);
    }
  }
}
QTableWidget *StManagerStudyListComp::createStudyTable ()
{
  QTableWidget *table  = new QTableWidget;

  table->setSelectionBehavior( QAbstractItemView::SelectRows );
  table->setSelectionMode( QAbstractItemView::SingleSelection );
  table->setEditTriggers( QAbstractItemView::NoEditTriggers );

  QStringList labels;
  for ( int i = 0; i < ATTRIBUTE_NUMBER; i++ ) {
    labels << tr( attributeNames[i] );
  }
  
  table->setColumnCount( labels.size() + 1 );
  table->setHorizontalHeaderLabels( labels );
  table->setColumnHidden( ATTRIBUTE_NUMBER, true );

  for ( int i = 0; i < ATTRIBUTE_NUMBER; i++ ) 
  {
    if ( attributeResizes[i] ) {
      table->horizontalHeader()->setResizeMode( i, QHeaderView::ResizeToContents );
    }
  }

  connect( table, SIGNAL(itemSelectionChanged()), this, SLOT(setEnabledView()) );
  connect( table, SIGNAL(itemDoubleClicked( QTableWidgetItem * )), this, SLOT(view()) );

  return table;
}
예제 #9
0
static QTableWidget* createFilesTable(const QStringList &fileNames)
{
    QTableWidget *table = new QTableWidget(0, 2);
    table->setSelectionMode(QAbstractItemView::NoSelection);

    QStringList labels({
                           QCoreApplication::translate("AddImageToResources","Filename"),
                           QCoreApplication::translate("AddImageToResources","Size")
                       });
    table->setHorizontalHeaderLabels(labels);
    table->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
    table->verticalHeader()->hide();
    table->setShowGrid(false);

    for (const QString &filePath : fileNames) {
           const QString toolTip = QDir::toNativeSeparators(filePath);
           const QString fileName = QFileInfo(filePath).fileName();
           const qint64 size = QFileInfo(filePath).size() / 1024;
           QTableWidgetItem *fileNameItem = new QTableWidgetItem(fileName);
           fileNameItem->setToolTip(toolTip);
           fileNameItem->setFlags(fileNameItem->flags() ^ Qt::ItemIsEditable);
           QTableWidgetItem *sizeItem = new QTableWidgetItem(QString::number(size) + " KB");
           sizeItem->setToolTip(toolTip);
           sizeItem->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
           sizeItem->setFlags(sizeItem->flags() ^ Qt::ItemIsEditable);

           int row = table->rowCount();
           table->insertRow(row);
           table->setItem(row, 0, fileNameItem);
           table->setItem(row, 1, sizeItem);
       }

    return table;
}
예제 #10
0
QTableWidget* StatusViewer::prepareTable(int rows, int cols) {
    QTableWidget* table = new QTableWidget(this);
    table->setColumnCount(cols);
    table->setRowCount(rows);
    table->setSelectionBehavior(QAbstractItemView::SelectRows);
    table->setAttribute(Qt::WA_MacShowFocusRect, 0);
    table->setShowGrid(false);
    table->setAlternatingRowColors(true);
    table->setSortingEnabled(false);

    for (int c = 0; c < cols; ++c) {
        table->horizontalHeader()->setSectionResizeMode(c, QHeaderView::Stretch);
    }
    
    for(int row=0; row<rows; ++row) {
        for(int col=0; col<cols; ++col){
            QTableWidgetItem* tableItem = new QTableWidgetItem();
            tableItem->setFlags(tableItem->flags() ^ Qt::ItemIsEditable);
            tableItem->setTextAlignment(Qt::AlignRight);
            tableItem->setText("--");
            table->setItem(row, col, tableItem);
        }
    }
    
    return table;
}
예제 #11
0
파일: window.cpp 프로젝트: CodeDJ/qt5-hidpi
void Window::createGUI()
{
    QList<QPair<QString, QColor> > list;
    list << QPair<QString, QColor>(tr("Alice"), QColor("aliceblue")) <<
            QPair<QString, QColor>(tr("Neptun"), QColor("aquamarine")) <<
            QPair<QString, QColor>(tr("Ferdinand"), QColor("springgreen"));

    QTableWidget *table = new QTableWidget(3, 2);
    table->setHorizontalHeaderLabels(QStringList() << tr("Name")
                                                   << tr("Hair Color"));
    table->verticalHeader()->setVisible(false);
    table->resize(150, 50);

    for (int i = 0; i < 3; ++i) {
        QPair<QString, QColor> pair = list.at(i);

        QTableWidgetItem *nameItem = new QTableWidgetItem(pair.first);
        QTableWidgetItem *colorItem = new QTableWidgetItem;
        colorItem->setData(Qt::DisplayRole, pair.second);

        table->setItem(i, 0, nameItem);
        table->setItem(i, 1, colorItem);
    }
    table->resizeColumnToContents(0);
    table->horizontalHeader()->setStretchLastSection(true);

    QGridLayout *layout = new QGridLayout;
    layout->addWidget(table, 0, 0);

    setLayout(layout);

    setWindowTitle(tr("Color Editor Factory"));
}
예제 #12
0
std::string Table::saveState()
{
    QTableWidget *tablewidget = static_cast<QTableWidget*>(getQWidget());
    QByteArray hhState = tablewidget->horizontalHeader()->saveState();
    QByteArray vhState = tablewidget->verticalHeader()->saveState();
    size_t len1 = hhState.length(), len2 = vhState.length();
    std::string hh(hhState.constData(), hhState.length()), vh(vhState.constData(), vhState.length());
    std::string state = boost::lexical_cast<std::string>(len1) + ":" + boost::lexical_cast<std::string>(len2) + ":" + hh + vh;
    return state;
}
예제 #13
0
void QgsMessageLogViewer::logMessage( QString message, QString tag, QgsMessageLog::MessageLevel level )
{
#ifdef ANDROID
  mCount++;
#else
  mButton->setToolTip( tr( "%1 message(s) logged." ).arg( mCount++ ) );
#endif

  if ( !isVisible() && level > QgsMessageLog::INFO )
  {
    mButton->show();
    if ( mShowToolTips )
      QToolTip::showText( mButton->mapToGlobal( QPoint( 0, 0 ) ), mButton->toolTip() );
  }

  if ( tag.isNull() )
    tag = tr( "General" );

  int i;
  for ( i = 0; i < tabWidget->count() && tabWidget->tabText( i ) != tag; i++ )
    ;

  QTableWidget *w;
  if ( i < tabWidget->count() )
  {
    w = qobject_cast<QTableWidget *>( tabWidget->widget( i ) );
    tabWidget->setCurrentIndex( i );
  }
  else
  {
    w = new QTableWidget( 0, 3, this );
    w->verticalHeader()->setDefaultSectionSize( 16 );
    w->verticalHeader()->setResizeMode( QHeaderView::ResizeToContents );
    w->verticalHeader()->setVisible( false );
    w->setGridStyle( Qt::DotLine );
    w->setEditTriggers( QAbstractItemView::NoEditTriggers );
    w->setHorizontalScrollMode( QAbstractItemView::ScrollPerPixel );
    w->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
    w->setHorizontalHeaderLabels( QStringList() << tr( "Timestamp" ) << tr( "Message" ) << tr( "Level" ) );
    tabWidget->addTab( w, tag );

    tabWidget->setCurrentIndex( tabWidget->count() - 1 );
  }

  int n = w->rowCount();

  w->setRowCount( n + 1 );
  QTableWidgetItem *item = new QTableWidgetItem( QDateTime::currentDateTime().toString( Qt::ISODate ) );
  w->setItem( n, 0, item );
  w->setItem( n, 1, new QTableWidgetItem( message ) );
  w->setItem( n, 2, new QTableWidgetItem( QString::number( level ) ) );
  w->scrollToBottom();

  w->horizontalHeader()->resizeSections( QHeaderView::ResizeToContents );
}
예제 #14
0
void MainWindow::standartStuffForAllTables(QTableWidget& table)
{
    table.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    table.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    table.setEditTriggers(QAbstractItemView::NoEditTriggers);
    table.verticalHeader()->hide();
    table.horizontalHeader()->hide();
    table.setEditTriggers(QAbstractItemView::NoEditTriggers);
    table.setSelectionMode(QAbstractItemView::NoSelection);
    table.setFocusPolicy(Qt::NoFocus);
}
예제 #15
0
QList<QWidget*> DataProvider::toolboxPages() {
  QList<QWidget*> l;

  // ---------------- Info Table ---------------------------
  QList<QString> keys = providerInformation.keys();
  QTableWidget* table = new QTableWidget(keys.size(),2);
  for (int i=0; i<keys.size(); i++) {
    table->setItem(i, 0, new QTableWidgetItem(keys.at(i)));
    table->setItem(i, 1, new QTableWidgetItem(providerInformation[keys.at(i)].toString()));
    table->item(i,0)->setFlags(Qt::ItemIsEnabled);
    table->item(i,1)->setFlags(Qt::ItemIsEnabled);
  }
  table->setObjectName("Info");
  table->horizontalHeader()->setStretchLastSection(true);
  table->verticalHeader()->setDefaultSectionSize(table->fontMetrics().lineSpacing()+5);
  table->verticalHeader()->hide();
  table->horizontalHeader()->hide();
  l << table;
  // ---------------------------------------------------------
  return l;
}
예제 #16
0
bool Table::restoreState(std::string state)
{
    QTableWidget *tablewidget = static_cast<QTableWidget*>(getQWidget());
    size_t d1 = state.find(":"), d2 = state.find(":", d1 + 1);
    std::string slen1 = state.substr(0, d1), slen2 = state.substr(d1 + 1, d2 - d1);
    size_t len1 = boost::lexical_cast<size_t>(slen1), len2 = boost::lexical_cast<size_t>(slen2);
    const char *s = state.c_str() + d2 + 1;
    QByteArray hhState(s, len1), vhState(s + len1, len2);
    bool ret = true;
    ret = ret && tablewidget->horizontalHeader()->restoreState(hhState);
    ret = ret && tablewidget->verticalHeader()->restoreState(vhState);
    return ret;
}
예제 #17
0
openvolume::openvolume( QWidget * parent ) :
	QDialog( parent )
{
	m_ui = new Ui::openvolume() ;
	m_ui->setupUi( this ) ;
	this->setFixedSize( this->size() ) ;
	this->setFont( parent->font() ) ;

	connect( m_ui->tableWidget,SIGNAL( itemDoubleClicked( QTableWidgetItem * ) ),this,SLOT( tableEntryDoubleClicked( QTableWidgetItem * ) ) ) ;
	connect( m_ui->tableWidget,SIGNAL( currentItemChanged( QTableWidgetItem *,QTableWidgetItem * ) ),this,
		 SLOT( currentItemChanged( QTableWidgetItem *,QTableWidgetItem * ) ) ) ;
	connect( m_ui->pbHelp,SIGNAL( clicked() ),this,SLOT( pbHelp() ) ) ;
	connect( m_ui->pbUUID,SIGNAL( clicked() ),this,SLOT( pbUUID() ) ) ;
	connect( m_ui->pbCancel,SIGNAL( clicked() ),this,SLOT( pbCancel() ) ) ;

	m_action = new QAction( this ) ;
	QList<QKeySequence> keys ;
	keys.append( Qt::Key_Enter ) ;
	keys.append( Qt::Key_Return ) ;
	m_action->setShortcuts( keys ) ;

	connect( m_action,SIGNAL( triggered() ),this,SLOT( EnterKeyPressed() ) ) ;

	this->addAction( m_action ) ;

	QTableWidget * tw = m_ui->tableWidget ;
	tw->setColumnWidth( 0,183 ) ;
	tw->setColumnWidth( 1,90 ) ;
	//tw->setColumnWidth( 2,110 ) ;
	tw->hideColumn( 2 ) ;
	tw->setColumnWidth( 3,90 ) ;
	tw->setColumnWidth( 4,309 ) ;

	for( int i = 0 ; i < 5 ; i++ ){
		tw->horizontalHeaderItem( i )->setFont( this->font() ) ;
	}
	tw->horizontalHeader()->setVisible( true ) ;

	m_ui->checkBoxUUID->setVisible( false ) ;

	m_diableNonLUKS = false ;
	//m_ui->pbUUID->setVisible( false ) ;
	m_showEncryptedOnly = false ;
	m_showLuksOnly = false ;

	this->installEventFilter( this ) ;
}
예제 #18
0
void
CLOAD_WORKSHEET::
CreateTable(QTabWidget * tabWidget, QString tabName, quint64 rowCount)
{
    quint64 columnCount = 12;

    // Table attributes
    QTableWidget * tableWidget = new QTableWidget();
    QHeaderView * header = tableWidget->horizontalHeader();
    header->setSectionResizeMode(QHeaderView::Stretch);
    header->setStretchLastSection(true);
    tableWidget->setAlternatingRowColors(true);
    tableWidget->setRowCount(rowCount);
    tableWidget->setColumnCount(columnCount);

    // set table column header
    tableWidget->setHorizontalHeaderItem(0,new QTableWidgetItem("Name"));
    tableWidget->setHorizontalHeaderItem(1,new QTableWidgetItem("Value"));
    tableWidget->setHorizontalHeaderItem(2,new QTableWidgetItem("Value Range"));
    tableWidget->setHorizontalHeaderItem(3,new QTableWidgetItem("    Type   "));
    tableWidget->setHorizontalHeaderItem(4,new QTableWidgetItem("Conversion"));
    tableWidget->setHorizontalHeaderItem(5,new QTableWidgetItem("Byte Offset"));
    tableWidget->setHorizontalHeaderItem(6,new QTableWidgetItem("Bit Offset"));
    tableWidget->setHorizontalHeaderItem(7,new QTableWidgetItem("Bit Size"));
    tableWidget->setHorizontalHeaderItem(8,new QTableWidgetItem("Field Used"));
    tableWidget->setHorizontalHeaderItem(9,new QTableWidgetItem("Low Byte First"));
    tableWidget->setHorizontalHeaderItem(10,new QTableWidgetItem("Group"));
    tableWidget->setHorizontalHeaderItem(11,new QTableWidgetItem("Encoding Factor"));

    tableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
    tableWidget->horizontalHeader()->setSectionResizeMode(2, QHeaderView::ResizeToContents);
    tableWidget->horizontalHeader()->setSectionResizeMode(3, QHeaderView::ResizeToContents);
    tableWidget->horizontalHeader()->setSectionResizeMode(4, QHeaderView::ResizeToContents);
    tableWidget->horizontalHeader()->setSectionResizeMode(5, QHeaderView::ResizeToContents);
    tableWidget->horizontalHeader()->setSectionResizeMode(6, QHeaderView::ResizeToContents);
    tableWidget->horizontalHeader()->setSectionResizeMode(7, QHeaderView::ResizeToContents);
    tableWidget->horizontalHeader()->setSectionResizeMode(8, QHeaderView::ResizeToContents);
    tableWidget->horizontalHeader()->setSectionResizeMode(9, QHeaderView::ResizeToContents);
    tableWidget->horizontalHeader()->setSectionResizeMode(10, QHeaderView::ResizeToContents);
    tableWidget->horizontalHeader()->setSectionResizeMode(11, QHeaderView::ResizeToContents);

    // add tab
    tabWidget->addTab(tableWidget, tabName);    
}
예제 #19
0
StakeReportDialog::StakeReportDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::StakeReportDialog)
{
    ui->setupUi(this);

    QTableWidget *TableW = ui->StakeReportTable;

    alreadyConnected = false;

    // fill the table with clone of row 0
    for(int y=TableW->rowCount(); --y >= 1;)
        for(int x=TableW->columnCount(); --x >= 0;)
            TableW->setItem(y, x,
                TableW->item(0, x)->clone());

    TableW->horizontalHeader()->resizeSection(1,160);

    QApplication::processEvents();

    updateStakeReportNow();  // 1st update
}
예제 #20
0
QTableWidget *PublicTalks::getPersons(int type)
{
    std::vector<sql_item> vt;
//    QString str = "SELECT yleisokokous.pvm, henkilot.nimi, henkilot.id, henkilot.etunimi "
//                  "FROM henkilot LEFT JOIN yleisokokous ON henkilot.id = yleisokokous.puheenjohtaja_id "
//                  "WHERE ohjelmatyypit & " + QString::number(type) + " GROUP BY henkilot.id";
    QString str = "SELECT yleisokokous.pvm, henkilot.nimi, henkilot.id, henkilot.etunimi "
                  "FROM henkilot LEFT JOIN yleisokokous ON henkilot.id = yleisokokous.";
    if(type == person::chairman) {
        str.append("puheenjohtaja_id");
    } else {
        str.append("vt_lukija_id");
    }
    str.append(" WHERE ohjelmatyypit & " + QString::number(type) + " GROUP BY henkilot.id");

    vt = sql.selectSql(str);

    QTableWidget *vttable = new QTableWidget();
    vttable->horizontalHeader()->show();
    vttable->verticalHeader()->setVisible(false);
    vttable->setColumnCount(3);
    vttable->setColumnHidden(0,true);
    vttable->setColumnWidth(1,150);
    vttable->setColumnWidth(2,100);
    vttable->setMinimumWidth(270);
    vttable->setSortingEnabled(true);

    vttable->setHorizontalHeaderItem(1,new QTableWidgetItem(QObject::tr("Name")));
    vttable->setHorizontalHeaderItem(2,new QTableWidgetItem(QObject::tr("Last")));

    vttable->setRowCount(vt.size()+1);
    vttable->setItem(0,0,new QTableWidgetItem(""));
    for(unsigned int i = 0; i < vt.size(); i++) {
        vttable->setItem(i+1,0,new QTableWidgetItem(vt[i].getValue("id")));
        vttable->setItem(i+1,1,new QTableWidgetItem(vt[i].getValue("nimi") + " " + vt[i].getValue("etunimi")));
        vttable->setItem(i+1,2,new QTableWidgetItem(vt[i].getValue("pvm")));
    }
    return vttable;
}
예제 #21
0
QTableWidget* AutoImportWindow::setupFilesTable() {
    QTableWidget* filesTable = new QTableWidget(0, 6);
    filesTable->setSelectionBehavior(QAbstractItemView::SelectRows);
    filesTable->setAttribute(Qt::WA_MacShowFocusRect, 0);

    QStringList labels;
    labels << "" << tr("Directory") << tr("Search Name") << tr("Averaged") << tr("Aligned") << tr("Raw");
    filesTable->setHorizontalHeaderLabels(labels);
    filesTable->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Stretch);
    filesTable->verticalHeader()->hide();
    filesTable->setShowGrid(false);
    filesTable->setAlternatingRowColors(true);
    
    connect(filesTable, &QTableWidget::itemDoubleClicked, [=](QTableWidgetItem *item){
        if(item->row() != -1 && item->row() < rowToImagePaths_.size()) {
            QString path = rowToImagePaths_[item->row()];
            ProjectImage* image = projectData.projectImage(QDir(projectData.projectDir().absoluteFilePath(path)));
            if(image) emit imageToBeOpened(image);
            else QMessageBox::warning(this, "Image Open Error!", "Image: " + path + " was either not imported or not found.");
        }
    });

    return filesTable;
}
예제 #22
0
KeyBinder::KeyBinder(QWidget * parent, const QString & helpText, const QString & defaultText, const QString & resetButtonText) : QWidget(parent)
{
    this->defaultText = defaultText;
    enableSignal = false;

    // Two-column tab layout
    QHBoxLayout * pageKeysLayout = new QHBoxLayout(this);
    pageKeysLayout->setSpacing(0);
    pageKeysLayout->setContentsMargins(0, 0, 0, 0);

    // Table for category list
    QVBoxLayout * catListContainer = new QVBoxLayout();
    catListContainer->setContentsMargins(10, 10, 10, 10);
    catList = new QListWidget();
    catList->setFixedWidth(180);
    catList->setStyleSheet("QListWidget::item { font-size: 14px; } QListWidget:hover { border-color: #F6CB1C; } QListWidget::item:selected { background: #150A61; color: yellow; }");
    catList->setFocusPolicy(Qt::NoFocus);
    connect(catList, SIGNAL(currentRowChanged(int)), this, SLOT(changeBindingsPage(int)));
    catListContainer->addWidget(catList);
    pageKeysLayout->addLayout(catListContainer);

    // Reset all binds button
    if (!resetButtonText.isEmpty())
    {
        QPushButton * btnResetAll = new QPushButton(resetButtonText);
        catListContainer->addWidget(btnResetAll);
        btnResetAll->setFixedHeight(40);
        catListContainer->setStretch(1, 0);
        catListContainer->setSpacing(10);
        connect(btnResetAll, SIGNAL(clicked()), this, SIGNAL(resetAllBinds()));
    }

    // Container for pages of key bindings
    QWidget * bindingsPagesContainer = new QWidget();
    QVBoxLayout * rightLayout = new QVBoxLayout(bindingsPagesContainer);

    // Scroll area for key bindings
    QScrollArea * scrollArea = new QScrollArea();
    scrollArea->setContentsMargins(0, 0, 0, 0);
    scrollArea->setWidget(bindingsPagesContainer);
    scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    scrollArea->setWidgetResizable(true);
    scrollArea->setFrameShape(QFrame::NoFrame);
    scrollArea->setStyleSheet("background: #130F2A;");

    // Add key binding pages to bindings tab
    pageKeysLayout->addWidget(scrollArea);
    pageKeysLayout->setStretch(1, 1);

    // Custom help text
    QLabel * helpLabel = new QLabel();
    helpLabel->setText(helpText);
    helpLabel->setStyleSheet("color: #130F2A; background: #F6CB1C; border: solid 4px #F6CB1C; border-radius: 10px; padding: auto 20px;");
    helpLabel->setFixedHeight(24);
    rightLayout->addWidget(helpLabel, 0, Qt::AlignCenter);

    // Category list and bind table row heights
    const int rowHeight = 20;
    QSize catSize, headerSize;
    catSize.setHeight(36);
    headerSize.setHeight(24);

    // Category list header
    QListWidgetItem * catListHeader = new QListWidgetItem(tr("Category"));
    catListHeader->setSizeHint(headerSize);
    catListHeader->setFlags(Qt::NoItemFlags);
    catListHeader->setForeground(QBrush(QColor("#130F2A")));
    catListHeader->setBackground(QBrush(QColor("#F6CB1C")));
    catListHeader->setTextAlignment(Qt::AlignCenter);
    catList->addItem(catListHeader);

    // Populate
    bindingsPages = new QHBoxLayout();
    bindingsPages->setContentsMargins(0, 0, 0, 0);
    rightLayout->addLayout(bindingsPages);
    QWidget * curPage = NULL;
    QVBoxLayout * curLayout = NULL;
    QTableWidget * curTable = NULL;
    bool bFirstPage = true;
    selectedBindTable = NULL;
    bindComboBoxCellMappings = new QHash<QObject *, QTableWidgetItem *>();
    bindCellComboBoxMappings = new QHash<QTableWidgetItem *, QComboBox *>();
    for (int i = 0; i < BINDS_NUMBER; i++)
    {
        if (cbinds[i].category != NULL)
        {
            // Add stretch at end of previous layout
            if (curLayout != NULL) curLayout->insertStretch(-1, 1);

            // Category list item
            QListWidgetItem * catItem = new QListWidgetItem(HWApplication::translate("binds (categories)", cbinds[i].category));
            catItem->setSizeHint(catSize);
            catList->addItem(catItem);

            // Create new page
            curPage = new QWidget();
            curLayout = new QVBoxLayout(curPage);
            curLayout->setSpacing(2);
            bindingsPages->addWidget(curPage);
            if (!bFirstPage) curPage->setVisible(false);
        }

        // Description
        if (cbinds[i].description != NULL)
        {
            QLabel * desc = new QLabel(HWApplication::translate("binds (descriptions)", cbinds[i].description));
            curLayout->addWidget(desc, 0);
            QFrame * divider = new QFrame();
            divider->setFrameShape(QFrame::HLine);
            divider->setFrameShadow(QFrame::Plain);
            curLayout->addWidget(divider, 0);
        }

        // New table
        if (cbinds[i].category != NULL || cbinds[i].description != NULL)
        {
            curTable = new QTableWidget(0, 2);
            curTable->verticalHeader()->setVisible(false);
            curTable->horizontalHeader()->setVisible(false);
            curTable->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
            curTable->verticalHeader()->setDefaultSectionSize(rowHeight);
            curTable->setShowGrid(false);
            curTable->setStyleSheet("QTableWidget { border: none; } ");
            curTable->setSelectionBehavior(QAbstractItemView::SelectRows);
            curTable->setSelectionMode(QAbstractItemView::SingleSelection);
            curTable->setFocusPolicy(Qt::NoFocus);
            connect(curTable, SIGNAL(itemSelectionChanged()), this, SLOT(bindSelectionChanged()));
            connect(curTable, SIGNAL(itemClicked(QTableWidgetItem *)), this, SLOT(bindCellClicked(QTableWidgetItem *)));
            curLayout->addWidget(curTable, 0);
        }

        // Hidden combo box
        QComboBox * comboBox = CBBind[i] = new QComboBox(curTable);
        comboBox->setModel((QAbstractItemModel*)DataManager::instance().bindsModel());
        comboBox->setVisible(false);
        comboBox->setFixedWidth(200);

        // Table row
        int row = curTable->rowCount();
        QTableWidgetItem * nameCell = new QTableWidgetItem(HWApplication::translate("binds", cbinds[i].name));
        nameCell->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
        curTable->insertRow(row);
        curTable->setItem(row, 0, nameCell);
        QTableWidgetItem * bindCell = new QTableWidgetItem(comboBox->currentText());
        bindCell->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
        curTable->setItem(row, 1, bindCell);
        curTable->resizeColumnsToContents();
        curTable->setFixedHeight(curTable->verticalHeader()->length() + 10);

        // Updates the text in the table cell
        connect(comboBox, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(bindChanged(const QString &)));

        // Map combo box and that row's cells to each other
        bindComboBoxCellMappings->insert(comboBox, bindCell);
        bindCellComboBoxMappings->insert(nameCell, comboBox);
        bindCellComboBoxMappings->insert(bindCell, comboBox);
    }
예제 #23
0
void InfoDialog::setupUi(const Tags &tags)
{
  int row = 0;
  QVBoxLayout *layout = new QVBoxLayout;

  layout->setContentsMargins(0,0,0,0);

  setWindowTitle(tr("EXIF information"));
  if (!tags.fileName().isEmpty())
    setWindowTitle(windowTitle() + " - " + QFileInfo(tags.fileName()).fileName());
  setWindowIcon(QIcon(":images/exif_info"));

  if (tags.size())
  {
    QMapIterator<int, QPair<Tag, Data> > tag(tags);
    QTableWidget *tableWidget = new QTableWidget(tags.size(),2,this);

    tableWidget->setAlternatingRowColors(true);
    tableWidget->verticalHeader()->setVisible(false);
    tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
    tableWidget->setSelectionMode(QAbstractItemView::NoSelection);
    tableWidget->setHorizontalHeaderItem(0,new QTableWidgetItem(tr("Tag")));
    tableWidget->setHorizontalHeaderItem(1,new QTableWidgetItem(tr("Value")));
    tableWidget->horizontalHeader()->setStretchLastSection(true);

    while (tag.hasNext())
    {
      QTableWidgetItem *item;
      QPair<Tag,Data> exifValue = tag.next().value();

      item = new QTableWidgetItem(exifValue.first.title);
      item->setToolTip(exifValue.first.description.split(". ",QString::SkipEmptyParts).join("\n"));
      tableWidget->setItem(row,0,item);
      item = new QTableWidgetItem(exifValue.second.readableValue);
      item->setToolTip(exifValue.first.description.split(". ",QString::SkipEmptyParts).join("\n"));
      tableWidget->setItem(row++,1,item);
    }

    tableWidget->resizeColumnsToContents();
    tableWidget->resizeRowsToContents();

    layout->addWidget(tableWidget);
  }
  else
  {
    QLabel *label = new QLabel(tr("No EXIF information available"),this);
    label->setAlignment(Qt::AlignCenter);
    layout->addWidget(label);
  }

#ifdef Q_WS_MAC
  QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok,Qt::Horizontal,this);

  connect(buttonBox,SIGNAL(accepted()),this,SLOT(close()));

  layout->addWidget(buttonBox);
#endif

  setLayout(layout);

  resize(600,400);
}
예제 #24
0
lcQPropertiesDialog::lcQPropertiesDialog(QWidget *parent, void *data) :
	QDialog(parent),
	ui(new Ui::lcQPropertiesDialog)
{
	ui->setupUi(this);

	ui->fogDensityEdit->setValidator(new QDoubleValidator());

	connect(ui->solidColorButton, SIGNAL(clicked()), this, SLOT(colorClicked()));
	connect(ui->gradient1ColorButton, SIGNAL(clicked()), this, SLOT(colorClicked()));
	connect(ui->gradient2ColorButton, SIGNAL(clicked()), this, SLOT(colorClicked()));
	connect(ui->fogColorButton, SIGNAL(clicked()), this, SLOT(colorClicked()));
	connect(ui->ambientColorButton, SIGNAL(clicked()), this, SLOT(colorClicked()));

	options = (lcPropertiesDialogOptions*)data;

	setWindowTitle(tr("%1 Properties").arg(options->Properties.mName));

	ui->descriptionEdit->setText(options->Properties.mDescription);
	ui->authorEdit->setText(options->Properties.mAuthor);
	ui->commentsEdit->setText(options->Properties.mComments);

	if (options->Properties.mBackgroundType == LC_BACKGROUND_IMAGE)
		ui->imageRadio->setChecked(true);
	else if (options->Properties.mBackgroundType == LC_BACKGROUND_GRADIENT)
		ui->gradientRadio->setChecked(true);
	else
		ui->solidRadio->setChecked(true);

	ui->imageNameEdit->setText(options->Properties.mBackgroundImage);
	ui->imageTileCheckBox->setChecked(options->Properties.mBackgroundImageTile);
	ui->fogCheckBox->setChecked(options->Properties.mFogEnabled);
	ui->fogDensityEdit->setText(QString::number(options->Properties.mFogDensity));

	QPixmap pix(12, 12);

	pix.fill(QColor(options->Properties.mBackgroundSolidColor[0] * 255, options->Properties.mBackgroundSolidColor[1] * 255, options->Properties.mBackgroundSolidColor[2] * 255));
	ui->solidColorButton->setIcon(pix);
	pix.fill(QColor(options->Properties.mBackgroundGradientColor1[0] * 255, options->Properties.mBackgroundGradientColor1[1] * 255, options->Properties.mBackgroundGradientColor1[2] * 255));
	ui->gradient1ColorButton->setIcon(pix);
	pix.fill(QColor(options->Properties.mBackgroundGradientColor2[0] * 255, options->Properties.mBackgroundGradientColor2[1] * 255, options->Properties.mBackgroundGradientColor2[2] * 255));
	ui->gradient2ColorButton->setIcon(pix);
	pix.fill(QColor(options->Properties.mFogColor[0] * 255, options->Properties.mFogColor[1] * 255, options->Properties.mFogColor[2] * 255));
	ui->fogColorButton->setIcon(pix);
	pix.fill(QColor(options->Properties.mAmbientColor[0] * 255, options->Properties.mAmbientColor[1] * 255, options->Properties.mAmbientColor[2] * 255));
	ui->ambientColorButton->setIcon(pix);

	lcPiecesLibrary *library = lcGetPiecesLibrary();
	lcArray<lcPartsListEntry>& partsUsed = options->PartsList;
	QStringList horizontalLabels, partNames;

	bool *colorsUsed = new bool[gNumUserColors];
	memset(colorsUsed, 0, sizeof(bool) * gNumUserColors);

	int *infoRows = new int[library->mPieces.GetSize()], numInfos = 0;
	memset(infoRows, 0, sizeof(int) * library->mPieces.GetSize());

	for (int partIdx = 0; partIdx < partsUsed.GetSize(); partIdx++)
	{
		colorsUsed[partsUsed[partIdx].ColorIndex] = true;

		int infoIndex = library->mPieces.FindIndex(partsUsed[partIdx].Info);
		if (!infoRows[infoIndex])
		{
			infoRows[infoIndex] = ++numInfos;
			partNames.append(partsUsed[partIdx].Info->m_strDescription);
		}
	}

	int *colorColumns = new int[gNumUserColors];
	memset(colorColumns, 0, sizeof(int) * gNumUserColors);
	int numColors = 0;

	horizontalLabels.append(tr("Part"));

	for (int colorIdx = 0; colorIdx < gNumUserColors; colorIdx++)
	{
		if (colorsUsed[colorIdx])
		{
			colorColumns[colorIdx] = numColors++;
			horizontalLabels.append(gColorList[colorIdx].Name);
		}
	}

	horizontalLabels.append(tr("Total"));

	QTableWidget *table = ui->partsTable;
	table->setColumnCount(numColors + 2);
	table->setRowCount(numInfos + 1);
	table->setHorizontalHeaderLabels(horizontalLabels);

#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
	table->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
#else
	table->horizontalHeader()->setResizeMode(0, QHeaderView::ResizeToContents);
#endif

	for (int rowIdx = 0; rowIdx < partNames.size(); rowIdx++)
		table->setItem(rowIdx, 0, new QTableWidgetItem(partNames[rowIdx]));

	table->setItem(partNames.size(), 0, new QTableWidgetItem(tr("Total")));

	QVector<int> infoTotals;
	QVector<int> colorTotals;
	int total = 0;

	infoTotals.resize(numInfos);
	colorTotals.resize(numColors);

	for (int partIdx = 0; partIdx < partsUsed.GetSize(); partIdx++)
	{
		int colorIndex = partsUsed[partIdx].ColorIndex;
		int infoIndex = library->mPieces.FindIndex(partsUsed[partIdx].Info);
		int count = partsUsed[partIdx].Count;

		QTableWidgetItem *item = new QTableWidgetItem(QString::number(count));
		item->setTextAlignment(Qt::AlignCenter);
		table->setItem(infoRows[infoIndex] - 1, colorColumns[colorIndex] + 1, item);

		infoTotals[infoRows[infoIndex] - 1] += count;
		colorTotals[colorColumns[colorIndex]] += count;
		total += count;
	}

	for (int infoIdx = 0; infoIdx < numInfos; infoIdx++)
	{
		QTableWidgetItem *item = new QTableWidgetItem(QString::number(infoTotals[infoIdx]));
		item->setTextAlignment(Qt::AlignCenter);
		table->setItem(infoIdx, numColors + 1, item);
	}

	for (int colorIdx = 0; colorIdx < numColors; colorIdx++)
	{
		QTableWidgetItem *item = new QTableWidgetItem(QString::number(colorTotals[colorIdx]));
		item->setTextAlignment(Qt::AlignCenter);
		table->setItem(numInfos, colorIdx + 1, item);
	}

	QTableWidgetItem *item = new QTableWidgetItem(QString::number(total));
	item->setTextAlignment(Qt::AlignCenter);
	table->setItem(numInfos, numColors + 1, item);

	delete[] colorColumns;
	delete[] colorsUsed;
	delete[] infoRows;
}
void QgsVectorGradientColorRampV2Dialog::on_btnInformation_pressed()
{
  if ( mRamp->info().isEmpty() )
    return;

  QgsDialog *dlg = new QgsDialog( this );
  QLabel *label = 0;

  // information table
  QTableWidget *tableInfo = new QTableWidget( dlg );
  tableInfo->verticalHeader()->hide();
  tableInfo->horizontalHeader()->hide();
  tableInfo->setRowCount( mRamp->info().count() );
  tableInfo->setColumnCount( 2 );
  int i = 0;
  for ( QgsStringMap::const_iterator it = mRamp->info().constBegin();
        it != mRamp->info().constEnd(); ++it )
  {
    if ( it.key().startsWith( "cpt-city" ) )
      continue;
    tableInfo->setItem( i, 0, new QTableWidgetItem( it.key() ) );
    tableInfo->setItem( i, 1, new QTableWidgetItem( it.value() ) );
    tableInfo->resizeRowToContents( i );
    i++;
  }
  tableInfo->resizeColumnToContents( 0 );
  tableInfo->horizontalHeader()->setStretchLastSection( true );
  tableInfo->setRowCount( i );
  tableInfo->setFixedHeight( tableInfo->rowHeight( 0 ) * i + 5 );
  dlg->layout()->addWidget( tableInfo );
  dlg->resize( 600, 250 );

  dlg->layout()->addSpacing( 5 );

  // gradient file
  QString gradientFile = mRamp->info().value( "cpt-city-gradient" );
  if ( ! gradientFile.isNull() )
  {
    QString fileName = gradientFile;
    fileName.replace( "<cpt-city>", QgsCptCityArchive::defaultBaseDir() );
    if ( ! QFile::exists( fileName ) )
    {
      fileName = gradientFile;
      fileName.replace( "<cpt-city>", "http://soliton.vm.bytemark.co.uk/pub/cpt-city" );
    }
    label = new QLabel( tr( "Gradient file : %1" ).arg( fileName ), dlg );
    label->setTextInteractionFlags( Qt::TextBrowserInteraction );
    dlg->layout()->addSpacing( 5 );
    dlg->layout()->addWidget( label );
  }

  // license file
  QString licenseFile = mRamp->info().value( "cpt-city-license" );
  if ( !licenseFile.isNull() )
  {
    QString fileName = licenseFile;
    fileName.replace( "<cpt-city>", QgsCptCityArchive::defaultBaseDir() );
    if ( ! QFile::exists( fileName ) )
    {
      fileName = licenseFile;
      fileName.replace( "<cpt-city>", "http://soliton.vm.bytemark.co.uk/pub/cpt-city" );
    }
    label = new QLabel( tr( "License file : %1" ).arg( fileName ), dlg );
    label->setTextInteractionFlags( Qt::TextBrowserInteraction );
    dlg->layout()->addSpacing( 5 );
    dlg->layout()->addWidget( label );
    if ( QFile::exists( fileName ) )
    {
      QTextEdit *textEdit = new QTextEdit( dlg );
      textEdit->setReadOnly( true );
      QFile file( fileName );
      if ( file.open( QIODevice::ReadOnly | QIODevice::Text ) )
      {
        textEdit->setText( file.readAll() );
        file.close();
        dlg->layout()->addSpacing( 5 );
        dlg->layout()->addWidget( textEdit );
        dlg->resize( 600, 500 );
      }
    }
  }

  dlg->show(); //non modal
}
예제 #26
0
void DossierEditeur::afficherProfil()
{
    try
    {
        QDialog* window = new QDialog(this);
        QGridLayout* lay = new QGridLayout;
        QPushButton* ok = new QPushButton("Ok");
        window->setWindowTitle("Profil");
        window->setFixedSize(400, 400);

        QStringList Formation = Dossier::getInstance().ListeCursus();
        int j = 1;
        QTableWidget* valide = new QTableWidget(1,1,this);
        QTableWidget* non_valide = new QTableWidget(1,1,this);
        QLabel* valideLabel = new QLabel("Validé :",this);
        QLabel* NonvalideLabel = new QLabel("A Valider :",this);
        valide->horizontalHeader()->hide();
        non_valide->horizontalHeader()->hide();
        valide->verticalHeader()->hide();
        non_valide->verticalHeader()->hide();
        valide->setMaximumSize(50,25);
        non_valide->setMaximumSize(50,25);

        QTableWidgetItem* ItemValide = new QTableWidgetItem("");
        ItemValide->setBackground(Qt::red);
        valide->setItem(0,0,ItemValide);

        QTableWidgetItem* ItemNonValide = new QTableWidgetItem("");
        ItemNonValide ->setBackground(Qt::gray);
        non_valide->setItem(0,0,ItemNonValide);
        //Tableaus affichant le nombre de crédits obtenu par catégorie
        for(QList<QString>::iterator it1 = Formation.begin(); it1 < Formation.end(); ++it1)
        {
            QMap<QString, unsigned int> ListeProfil = Dossier::getInstance().ListeProfil(*it1);
            QStringList P = ListeProfil.keys();
            QTableWidget* tab = new QTableWidget(1,ListeProfil.size(),this);
            tab->setHorizontalHeaderLabels(P);
            tab->setSelectionBehavior(QAbstractItemView::SelectRows);
            tab->verticalHeader()->hide();


            int i = 0;
            for(QList<QString>::iterator it2 = P.begin(); it2 < P.end(); ++it2)
            {
                QString cr; cr.setNum(ListeProfil[*it2]);
                QString creditFormation; creditFormation.setNum(FormationManager::getInstance().getFormation(*it1).getProfil(*it2));
                QString credit = cr +QString("(")+creditFormation+QString(")");
                QTableWidgetItem* monItem = new QTableWidgetItem(credit);
                if(FormationManager::getInstance().isFinished(*it1,*it2,ListeProfil[*it2]))
                    monItem->setBackground(Qt::red);
                else
                    monItem->setBackground(Qt::gray);
                tab->setItem(0,i,monItem);
                i++;
            }
            QLabel* form = new QLabel(*it1,this);
            lay->addWidget(form,j,0,1,3,Qt::AlignLeft);
            lay->addWidget(tab,j,1,1,3,Qt::AlignJustify);
            j++;
        }

        lay->addWidget(valideLabel,0,0);
        lay->addWidget(valide,0,1);
        lay->addWidget(NonvalideLabel,0,2);
        lay->addWidget(non_valide,0,3);
        lay->addWidget(ok,j,1,Qt::AlignHCenter);
        window->setLayout(lay);

        connect(ok,SIGNAL(clicked()),window,SLOT(accept()));
        window->exec();

        if(window->result())
        {

        }

    }
    catch(UTProfilerException& e)
    {
        QMessageBox::warning(this, "Ajout d'inscription", e.getInfo());
    }
}
예제 #27
0
void model_import_dlg::create_mesh_tab(QTabWidget * parent, size_t index, render::lod lod)
{
	QWidget * tab = new QWidget(parent);
	tab->setObjectName("meshTab");

	auto & geometry = conv.get(index).geometry.at(lod);
	auto & material = conv.get(index).materials.at(lod);

	QGroupBox * geometry_box = new QGroupBox(tab);
	geometry_box->setGeometry(10, 10, 561, 115);
	geometry_box->setTitle("Geometry");

	QLabel * vertices = new QLabel(geometry_box);
	vertices->setGeometry(20, 20, 200, 20);
	vertices->setText("Vertices: " + QString::number(geometry.vertex_count));

	QLabel * faces = new QLabel(geometry_box);
	faces->setGeometry(20, 40, 200, 20);
	faces->setText("Faces: " + QString::number(geometry.index_count / 3));

	QLabel * indices = new QLabel(geometry_box);
	indices->setGeometry(20, 60, 200, 20);
	indices->setText("Indices: " + QString::number(geometry.index_count));

	QLabel * layout = new QLabel(geometry_box);
	layout->setGeometry(20, 80, 200, 20);
	layout->setText("Layout: " + QString::fromStdString(render::vertex::str(geometry.vertex_type)));

	QGroupBox * material_box = new QGroupBox(tab);
	material_box->setGeometry(10, 130, 561, 400);
	material_box->setTitle("Material");

	QGroupBox * colors_box = new QGroupBox(material_box);
	colors_box->setGeometry(15, 20, 455, 134);
	colors_box->setTitle("Colors");

	QTableWidget * colorsTable = new QTableWidget(colors_box);
	colorsTable->setGeometry(15, 25, 237, 92);
	colorsTable->setObjectName("colorsTable");
	colorsTable->setRowCount(3);
	colorsTable->setColumnCount(3);
	colorsTable->setFrameShape(QFrame::NoFrame);
	colorsTable->setShowGrid(false);
	colorsTable->setSelectionBehavior(QAbstractItemView::SelectionBehavior::SelectRows);
	colorsTable->setEditTriggers(QAbstractItemView::DoubleClicked);
	colorsTable->horizontalHeader()->setDefaultSectionSize(60);
	colorsTable->verticalHeader()->setDefaultSectionSize(23);
	colorsTable->setSelectionMode(QAbstractItemView::SelectionMode::SingleSelection);

	QStringList color_types;
	color_types.append("Ambient");
	color_types.append("Diffuse");
	color_types.append("Specular");

	QStringList color_channels;
	color_channels.append("R");
	color_channels.append("G");
	color_channels.append("B");

	colorsTable->setVerticalHeaderLabels(color_types);
	colorsTable->setHorizontalHeaderLabels(color_channels);

	colorsTable->setItem(0, 0, new QTableWidgetItem(QString::number(rgb_to_byte(material.ambient.x))));
	colorsTable->setItem(0, 1, new QTableWidgetItem(QString::number(rgb_to_byte(material.ambient.y))));
	colorsTable->setItem(0, 2, new QTableWidgetItem(QString::number(rgb_to_byte(material.ambient.z))));
	colorsTable->setItem(1, 0, new QTableWidgetItem(QString::number(rgb_to_byte(material.diffuse.x))));
	colorsTable->setItem(1, 1, new QTableWidgetItem(QString::number(rgb_to_byte(material.diffuse.y))));
	colorsTable->setItem(1, 2, new QTableWidgetItem(QString::number(rgb_to_byte(material.diffuse.z))));
	colorsTable->setItem(2, 0, new QTableWidgetItem(QString::number(rgb_to_byte(material.specular.x))));
	colorsTable->setItem(2, 1, new QTableWidgetItem(QString::number(rgb_to_byte(material.specular.y))));
	colorsTable->setItem(2, 2, new QTableWidgetItem(QString::number(rgb_to_byte(material.specular.z))));

	QPushButton * colorPick = new QPushButton(colors_box);
	colorPick->setGeometry(290, 24, 75, 23);
	colorPick->setObjectName("colorPick");
	colorPick->setText("Pick");

	for (int i = 0; i < 3; i++)
		for (int j = 0; j < 3; j++)
			colorsTable->item(i, j)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);

	QObject::connect(colorsTable, SIGNAL(itemSelectionChanged()), this, SLOT(on_color_table_changed()));
	QObject::connect(colorPick, SIGNAL(pressed()), this, SLOT(on_color_pick()));

	QLabel * spec_power = new QLabel(colors_box);
	spec_power->setGeometry(290, 89, 80, 23);
	spec_power->setText("Specular power: ");

	QDoubleSpinBox * spec_power_box = new QDoubleSpinBox(colors_box);
	spec_power_box->setObjectName("specularSpinBox");
	spec_power_box->setDecimals(2);
	spec_power_box->setSingleStep(0.05);
	spec_power_box->setFrame(false);
	spec_power_box->setGeometry(390, 89, 50, 23);
	spec_power_box->setValue(material.specular_power);

	QGroupBox * textures_box = new QGroupBox(material_box);
	textures_box->setGeometry(15, 159, 531, 225);
	textures_box->setTitle("Textures");

	QTableWidget * texturesTable = new QTableWidget(textures_box);
	texturesTable->setObjectName("texturesTable");
	texturesTable->setGeometry(15, 25, 500, 150);
	texturesTable->setRowCount(material.textures.size());
	texturesTable->setColumnCount(2);
	texturesTable->setFrameShape(QFrame::NoFrame);
	texturesTable->setShowGrid(false);
	texturesTable->setSelectionBehavior(QAbstractItemView::SelectionBehavior::SelectRows);
	texturesTable->setEditTriggers(QAbstractItemView::DoubleClicked);
	texturesTable->horizontalHeader()->setDefaultSectionSize(60);
	texturesTable->verticalHeader()->setDefaultSectionSize(23);
	texturesTable->verticalHeader()->setVisible(false);

	QStringList texture_headers;
	texture_headers.append("File");
	texture_headers.append("Type");
	texturesTable->setHorizontalHeaderLabels(texture_headers);

	int i = 0;
	assimp::texture_type_map texture_map;

	for (auto texture : material.textures)
	{
		texturesTable->setItem(i, 0, new QTableWidgetItem(QString::fromStdString(texture.second.texture_path.generic_string())));
		texturesTable->setItem(i, 1, new QTableWidgetItem(QString::fromStdString(texture_map.get(texture.first))));
		texturesTable->setColumnWidth(0, 350);
		texturesTable->setColumnWidth(1, 150);

		i++;
	}

	for (i = 0; i < texturesTable->rowCount(); i++)
	for (int j = 0; j < texturesTable->columnCount(); j++)
		texturesTable->item(i, j)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);

	QPushButton * add_texture = new QPushButton(textures_box);
	add_texture->setGeometry(15, 185, 75, 23);
	add_texture->setText("Add");

	QPushButton * edit_texture = new QPushButton(textures_box);
	edit_texture->setGeometry(100, 185, 75, 23);
	edit_texture->setObjectName("textureEditButton");
	edit_texture->setText("Edit");
	edit_texture->setEnabled(false);

	QPushButton * delete_texture = new QPushButton(textures_box);
	delete_texture->setGeometry(185, 185, 75, 23);
	delete_texture->setObjectName("textureDeleteButton");
	delete_texture->setText("Delete");
	delete_texture->setEnabled(false);

	QObject::connect(texturesTable, SIGNAL(itemSelectionChanged()), this, SLOT(on_texture_table_changed()));
	QObject::connect(add_texture, SIGNAL(pressed()), this, SLOT(on_texture_add()));
	QObject::connect(edit_texture, SIGNAL(pressed()), this, SLOT(on_texture_edit()));
	QObject::connect(delete_texture, SIGNAL(pressed()), this, SLOT(on_texture_delete()));

	QString title = "Mesh " + QString::number(index);
	parent->addTab(tab, title);
}
예제 #28
0
void MainWindow::on_actionShortcuts_triggered() {

	QTableWidget* scTable = new QTableWidget();

	scTable->setRowCount(0);
	scTable->setColumnCount(2);

	scTable->setHorizontalHeaderItem(0, new QTableWidgetItem("Shortcut"));
	scTable->setHorizontalHeaderItem(1, new QTableWidgetItem("Description"));
	scTable->verticalHeader()->hide();


	QLinkedList<QPair<QString, QString>> scList;

	//read from file in resources and add to linked list
	QFile shortcutFile(":Shortcuts/resources/shortcuts.txt");

	if (!shortcutFile.open(QIODevice::ReadOnly | QIODevice::Text))
		return;

	QString line;
	while (!shortcutFile.atEnd()) {
		QTextStream stream(&shortcutFile);
		while (!stream.atEnd()) {
			line = stream.readLine();
			QStringList shortCutAndDescription = line.split(':');
			if (shortCutAndDescription.size() == 2) {
				scList.append(QPair<QString, QString>(shortCutAndDescription[0], shortCutAndDescription[1]));
			}
		}

	}

	QLinkedList<QPair<QString, QString>>::const_iterator sc;
	for (sc = scList.constBegin(); sc != scList.constEnd(); ++sc) {
		scTable->insertRow(scTable->rowCount());


		QTableWidgetItem* scKey = new QTableWidgetItem(sc->first);
		QTableWidgetItem* scKeyInfo = new QTableWidgetItem(sc->second);
		scKey->setFlags(Qt::NoItemFlags | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
		scKeyInfo->setFlags(Qt::NoItemFlags | Qt::ItemIsEnabled | Qt::ItemIsSelectable);

		scTable->setItem(scTable->rowCount() - 1, 0, scKey);
		scTable->setItem(scTable->rowCount() - 1, 1, scKeyInfo);
	}


	//scTable->horizontalHeader()->setStretchLastSection( true ); 
	scTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);

	QWidget* outerWidget = new QWidget();
	outerWidget->setWindowTitle("Shortcuts");
	outerWidget->resize(scTable->size());
	QVBoxLayout* vLayout = new QVBoxLayout();

	vLayout->addWidget(scTable);

	outerWidget->setLayout(vLayout);


	outerWidget->show();
}
예제 #29
0
void TSController::processDataParams(){
    //    qDebug()<<"TSController::processDataParams";
    qDebug()<<"this is result button !";
    QTableWidget *qtw = ui->resultsTable;
    qtw->setColumnCount(2);
    qtw->setRowCount(12);
    qtw->verticalHeader()->setVisible(false);
    qtw->setHorizontalHeaderLabels(QString(tr("Параметр;Значение")).split(";"));
    qtw->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
    /* tsanalitics* ga = new tsanalitics();
    tstempanalitic* gao = new tstempanalitic();
    tstempanalitic* gai = new tstempanalitic();*/
    float AvgExpirationSpeed=0, MaxExpirationSpeed=0, AvgExpirationTime=0, AvgInspirationTime=0,
            AvgRoundTime=0, AvgTempIn=0, AvgTempOut=0, AvgTempInMinusAvgTempOut=0,  BreathingVolume=0, MVL=0, MinuteVentilation=0;
    float InspirationFrequency=0;
    int *vo = curveBuffer->volume();
    int *ti = curveBuffer->tempIn();
    int *to = curveBuffer->tempOut();
    QVector<int> volume,temp_in,temp_out;
    for(int i=0;i<curveBuffer->getLenght();i++){
        volume.push_back(vo[i]);
        temp_in.push_back(ti[i]);
        temp_out.push_back(to[i]);
    }
    VolumeSolver* vs = new VolumeSolver(volume,temp_in,temp_out);

    AvgExpirationSpeed = vs->getAverageExpirationSpeed();
    qtw->setItem(1,0,getQTableWidgetItem(tr("Средняя скорость выдоха(л/с)")));
    qtw->setItem(1,1,getQTableWidgetItem(QString::number(fabs(curveBuffer->volToLtr((int)AvgExpirationSpeed)))));

    MaxExpirationSpeed = vs->getMaxExpirationSpeed();
    qtw->setItem(2,0,getQTableWidgetItem(tr("Максимальная скорость выдоха(л/с)")));
    qtw->setItem(2,1,getQTableWidgetItem(QString::number(fabs(curveBuffer->volToLtr((int)MaxExpirationSpeed)))));

    AvgExpirationTime = vs->getAverageExpirationTime();
    qtw->setItem(3,0,getQTableWidgetItem(tr("Среднее время выдоха(с)")));
    qtw->setItem(3,1,getQTableWidgetItem((QString::number((float)AvgExpirationTime))));

    AvgInspirationTime = vs->getAverageInspirationTime();
    qtw->setItem(4,0,getQTableWidgetItem(tr("Среднее время вдоха(с)")));
    qtw->setItem(4,1,getQTableWidgetItem((QString::number((float)AvgInspirationTime))));

    AvgRoundTime = vs->getAverageCycleTime();
    qtw->setItem(5,0,getQTableWidgetItem(tr("Средняя время цикла(с)")));
    qtw->setItem(5,1,getQTableWidgetItem((QString::number((float)AvgRoundTime))));

    InspirationFrequency = vs->getInspirationFrequancyInOneMinute();
    qtw->setItem(6,0,getQTableWidgetItem(tr("Частота дыхания(ед/мин)")));
    qtw->setItem(6,1,getQTableWidgetItem((QString::number(InspirationFrequency))));

    MinuteVentilation = vs->getMinuteVentilation();
    qtw->setItem(8,0,getQTableWidgetItem(tr("Минутная вентиляция легких(л)")));
    qtw->setItem(8,1,getQTableWidgetItem(QString::number(curveBuffer->volToLtr(MinuteVentilation))));

    BreathingVolume = vs->getAverageInspiratonVentilation();
    qtw->setItem(7,0,getQTableWidgetItem(tr("Дыхательный объем(л)")));
    qtw->setItem(7,1,getQTableWidgetItem(QString::number(fabs(curveBuffer->volToLtr((int)BreathingVolume)))));

    MVL = vs->getTotalVentilation();
    qtw->setItem(9,0,getQTableWidgetItem(tr("Суммарная вентиляция легких(л)")));
    qtw->setItem(9,1,getQTableWidgetItem(QString::number(fabs(curveBuffer->volToLtr((int)MVL)))));

    //ga->clear();

    AvgTempIn = vs->getAverageInspirationTempetature();
    qtw->setItem(10,0,getQTableWidgetItem(tr("Средняя температура вдоха( 'C)")));
    qtw->setItem(10,1,getQTableWidgetItem(QString::number(curveBuffer->tempInToDeg(AvgTempIn))));
    //gai->clear();

    AvgTempOut = vs->getAverageExpirationTempetature();
    qtw->setItem(11,0,getQTableWidgetItem(tr("Средняя температура выдоха( 'C)")));
    qtw->setItem(11,1,getQTableWidgetItem(QString::number(curveBuffer->tempOutToDeg(AvgTempOut))));

    AvgTempInMinusAvgTempOut = AvgTempOut-AvgTempIn;
    qtw->setItem(12,0,getQTableWidgetItem(tr("Средняя Твдоха-Средняя Твыдоха( 'C)")));
    qtw->setItem(12,1,getQTableWidgetItem(curveBuffer->tempOutToDeg(AvgTempOut)-curveBuffer->tempInToDeg(AvgTempIn)));

    qtw->removeRow(0);
    qtw->show();
    delete vs;
}
예제 #30
0
파일: confmport.cpp 프로젝트: peter1000/los
void MPConfig::rbClicked(QTableWidgetItem* item)
{
    if (item == 0)
        return;
    QString id = item->tableWidget()->item(item->row(), DEVCOL_NO)->text();
    int no = atoi(id.toLatin1().constData()) - 1;
    if (no < 0 || no >= kMaxMidiPorts)
        return;

    int n;
    MidiPort* port = &midiPorts[no];
    MidiDevice* dev = port->device();
    int rwFlags = dev ? dev->rwFlags() : 0;
    int openFlags = dev ? dev->openFlags() : 0;
    QTableWidget* listView = item->tableWidget();
    QPoint ppt = listView->visualItemRect(item).bottomLeft();
    QPoint mousepos = QCursor::pos();

    int col = item->column();
    ppt += QPoint(0, listView->horizontalHeader()->height());

    ppt = listView->mapToGlobal(ppt);

    switch (col)
    {
        case DEVCOL_GUI:
            if (dev == 0)
                //break;
                return;
            // falkTX, we don't want this in the connections manager
            //if (port->hasGui())
            //{
            //	port->instrument()->showGui(!port->guiVisible());
            //	item->setIcon(port->guiVisible() ? QIcon(*dotIcon) : QIcon(*dothIcon));
            //}
            //break;
            return;

        case DEVCOL_CACHE_NRPN:
            if (!dev)
                return;
            dev->setCacheNRPN(!dev->cacheNRPN());
            item->setIcon(dev->cacheNRPN() ? QIcon(*dotIcon) : QIcon(*dothIcon));

            return;

        case DEVCOL_REC:
            if (dev == 0 || !(rwFlags & 2))
                return;
            openFlags ^= 0x2;
            dev->setOpenFlags(openFlags);
            midiSeq->msgSetMidiDevice(port, dev); // reopen device
            item->setIcon(openFlags & 2 ? QIcon(*dotIcon) : QIcon(*dothIcon));

            if (dev->deviceType() == MidiDevice::JACK_MIDI)
            {
                if (dev->openFlags() & 2)
                {
                    item->tableWidget()->item(item->row(), DEVCOL_INROUTES)->setText(tr("in"));
                }
                else
                {
                    item->tableWidget()->item(item->row(), DEVCOL_INROUTES)->setText("");
                }
            }

            return;

        case DEVCOL_PLAY:
            if (dev == 0 || !(rwFlags & 1))
                return;
            openFlags ^= 0x1;
            dev->setOpenFlags(openFlags);
            midiSeq->msgSetMidiDevice(port, dev); // reopen device
            item->setIcon(openFlags & 1 ? QIcon(*dotIcon) : QIcon(*dothIcon));

            if (dev->deviceType() == MidiDevice::JACK_MIDI)
            {
                if (dev->openFlags() & 1)
                {
                    item->tableWidget()->item(item->row(), DEVCOL_OUTROUTES)->setText(tr("out"));
                }
                else
                {
                    item->tableWidget()->item(item->row(), DEVCOL_OUTROUTES)->setText("");
                }
            }

            return;

        case DEVCOL_INROUTES:
        case DEVCOL_OUTROUTES:
        {
            if (!checkAudioDevice())
                return;

            if (audioDevice->deviceType() != AudioDevice::JACK_AUDIO) //Only if Jack is running.
                return;

            if (!dev)
                return;

            // Only Jack midi devices.
            if (dev->deviceType() != MidiDevice::JACK_MIDI)
                return;

            if (!(dev->openFlags() & ((col == DEVCOL_OUTROUTES) ? 1 : 2)))
                return;

            RouteList* rl = (col == DEVCOL_OUTROUTES) ? dev->outRoutes() : dev->inRoutes(); // p3.3.55
            QMenu* pup = 0;
            int gid = 0;
            std::list<QString> sl;
            pup = new QMenu(this);
            //A temporary Route to us for matching later
            QString currentRoute("");
            bool routeSelected = false;

_redisplay:
            pup->clear();
            gid = 0;

            // Jack input ports if device is writable, and jack output ports if device is readable.
            sl = (col == DEVCOL_OUTROUTES) ? audioDevice->inputPorts(true, _showAliases) : audioDevice->outputPorts(true, _showAliases);

            QAction* act;

            act = pup->addAction(tr("Show first aliases"));
            act->setData(gid);
            act->setCheckable(true);
            act->setChecked(_showAliases == 0);
            ++gid;

            act = pup->addAction(tr("Show second aliases"));
            act->setData(gid);
            act->setCheckable(true);
            act->setChecked(_showAliases == 1);
            ++gid;

            pup->addSeparator();
            for (std::list<QString>::iterator ip = sl.begin(); ip != sl.end(); ++ip)
            {
                act = pup->addAction(*ip);
                act->setData(gid);
                act->setCheckable(true);

                Route rt(*ip, (col == DEVCOL_OUTROUTES), -1, Route::JACK_ROUTE);
                for (iRoute ir = rl->begin(); ir != rl->end(); ++ir)
                {
                    if (*ir == rt)
                    {
                        currentRoute = (*ir).name();
                        act->setChecked(true);
                        routeSelected = true;
                        break;
                    }
                }
                ++gid;
            }

            act = pup->exec(ppt);
            if (act)
            {
                n = act->data().toInt();
                if (n == 0) // Show first aliases
                {
                    if (_showAliases == 0)
                        _showAliases = -1;
                    else
                        _showAliases = 0;
                    goto _redisplay; // Go back
                }
                else if (n == 1) // Show second aliases
                {
                    if (_showAliases == 1)
                        _showAliases = -1;
                    else
                        _showAliases = 1;
                    goto _redisplay; // Go back
                }

                QString s(act->text());

                if (col == DEVCOL_OUTROUTES) // Writable
                {
                    Route srcRoute(dev, -1);
                    Route dstRoute(s, true, -1, Route::JACK_ROUTE);
                    if(routeSelected && currentRoute == s)
                    {
                        //it will alread be handled by an unchecked operation
                        routeSelected = false;
                    }

                    iRoute iir = rl->begin();
                    for (; iir != rl->end(); ++iir)
                    {
                        if (*iir == dstRoute)
                            break;
                    }

                    if (iir != rl->end())
                    {
                        // disconnect
                        audio->msgRemoveRoute(srcRoute, dstRoute);
                    }
                    else
                    {
                        // connect
                        audio->msgAddRoute(srcRoute, dstRoute);
                    }
                    if(routeSelected)
                    {
                        iRoute selr = rl->begin();
                        for (; selr != rl->end(); ++selr)
                        {
                            //clean up the routing list as something was selected that was not the current so delete the old route
                            if((*selr).name() == currentRoute)
                            {
                                audio->msgRemoveRoute(srcRoute, (*selr));
                                break;
                            }
                        }
                    }

                }
                else
                {
                    Route srcRoute(s, false, -1, Route::JACK_ROUTE);
                    Route dstRoute(dev, -1);

                    iRoute iir = rl->begin();
                    for (; iir != rl->end(); ++iir)
                    {
                        if (*iir == srcRoute)
                            break;
                    }
                    if (iir != rl->end())
                        // disconnect
                        audio->msgRemoveRoute(srcRoute, dstRoute);
                    else
                        // connect
                        audio->msgAddRoute(srcRoute, dstRoute);
                }

                audio->msgUpdateSoloStates();
                song->update(SC_ROUTE);
            }

            delete pup;
        }
            return;

        case DEVCOL_DEF_IN_CHANS:
        case DEVCOL_DEF_OUT_CHANS:
        {
        }
            //break;
            return;

        case DEVCOL_NAME:
        {
            //printf("MPConfig::rbClicked DEVCOL_NAME\n");

            // Did we click in the text area?
            // NOTE: this needs the +15 pixels to make up for padding in the stylesheet.
            if ((mousepos.x() - (ppt.x() + 15)) > buttondownIcon->width())
            {
                // Start the renaming of the cell...
                QModelIndex current = item->tableWidget()->currentIndex();
                if (item->flags() & Qt::ItemIsEditable)
                    item->tableWidget()->edit(current.sibling(current.row(), DEVCOL_NAME));

                return;
            }
            else
            {// We clicked the 'down' button.
                QMenu* pup = new QMenu(this);

                QAction* act;

                act = pup->addAction(tr("Create") + QT_TRANSLATE_NOOP("@default", " Jack") + tr(" device"));
                act->setData(0);

                typedef std::map<std::string, int > asmap;
                typedef std::map<std::string, int >::iterator imap;

                asmap mapALSA;
                asmap mapJACK;

                int aix = 0x10000000;
                int jix = 0x20000000;
                for (iMidiDevice i = midiDevices.begin(); i != midiDevices.end(); ++i)
                {
                    if ((*i)->deviceType() == MidiDevice::ALSA_MIDI)
                    {
                        mapALSA.insert(std::pair<std::string, int> (std::string((*i)->name().toLatin1().constData()), aix));
                        ++aix;
                    }
                    else if ((*i)->deviceType() == MidiDevice::JACK_MIDI)
                    {
                        mapJACK.insert(std::pair<std::string, int> (std::string((*i)->name().toLatin1().constData()), jix));
                        ++jix;
                    }
                    else
                        printf("MPConfig::rbClicked unknown midi device: %s\n", (*i)->name().toLatin1().constData());
                }

                pup->addSeparator();
                pup->addAction(new MenuTitleItem(QT_TRANSLATE_NOOP("@default", "ALSA:"), pup));

                for (imap i = mapALSA.begin(); i != mapALSA.end(); ++i)
                {
                    int idx = i->second;
                    QString s(i->first.c_str());
                    MidiDevice* md = midiDevices.find(s, MidiDevice::ALSA_MIDI);
                    if (md)
                    {
                        if (md->deviceType() != MidiDevice::ALSA_MIDI)
                            continue;

                        act = pup->addAction(QT_TRANSLATE_NOOP("@default", md->name()));
                        act->setData(idx);
                        act->setCheckable(true);
                        act->setChecked(md == dev);
                    }
                }

                pup->addSeparator();
                pup->addAction(new MenuTitleItem(QT_TRANSLATE_NOOP("@default", "JACK:"), pup));

                for (imap i = mapJACK.begin(); i != mapJACK.end(); ++i)
                {
                    int idx = i->second;
                    QString s(i->first.c_str());
                    MidiDevice* md = midiDevices.find(s, MidiDevice::JACK_MIDI);
                    if (md)
                    {
                        if (md->deviceType() != MidiDevice::JACK_MIDI)
                            continue;

                        act = pup->addAction(QT_TRANSLATE_NOOP("@default", md->name()));
                        act->setData(idx);
                        act->setCheckable(true);
                        act->setChecked(md == dev);
                    }
                }

                act = pup->exec(ppt);
                if (!act)
                {
                    delete pup;
                    return;
                }

                n = act->data().toInt();
                //printf("MPConfig::rbClicked n:%d\n", n);

                MidiDevice* sdev = 0;
                if (n < 0x10000000)
                {
                    delete pup;
                    if (n <= 2)
                    {
                        sdev = MidiJackDevice::createJackMidiDevice();

                        if (sdev)
                        {
                            int of = 3;
                            switch (n)
                            {
                                case 0: of = 0; //3; Set the open flags of the midiDevice this should be off by default
                                    break;
                                case 1: of = 2;
                                    break;
                                case 2: of = 1;
                                    break;
                            }
                            sdev->setOpenFlags(of);
                        }
                    }
                }
                else
                {
                    int typ;
                    if (n < 0x20000000)
                        typ = MidiDevice::ALSA_MIDI;
                    else if (n < 0x30000000)
                        typ = MidiDevice::JACK_MIDI;
                    else
                        typ = MidiDevice::UNKNOWN_MIDI;

                    sdev = midiDevices.find(act->text(), typ);
                    delete pup;

                    // Is it the current device? Reset it to <none>.
                    // falkTX, handle synths properly here
                    if (sdev == dev)
                    {
                        sdev = 0;
                    }
                    else
                    {
                    }
                }

                midiSeq->msgSetMidiDevice(port, sdev);
                los->changeConfig(true); // save configuration file
                song->update();
            }
        }
            //break;
            return;

        case DEVCOL_INSTR:
        {
            if (instrPopup == 0)
                instrPopup = new QMenu(this);
            instrPopup->clear();
            for (iMidiInstrument i = midiInstruments.begin(); i != midiInstruments.end(); ++i)
            {
                instrPopup->addAction((*i)->iname());
            }

            QAction* act = instrPopup->exec(ppt, 0);
            if (!act)
                return;
            QString s = act->text();
            item->tableWidget()->item(item->row(), DEVCOL_INSTR)->setText(s);
            for (iMidiInstrument i = midiInstruments.begin(); i != midiInstruments.end(); ++i)
            {
                if ((*i)->iname() == s)
                {
                    port->setInstrument(*i);
                    break;
                }
            }
            song->update();
        }
            return;
    }
}