示例#1
1
/**
* @brief ctor for main window
*
* @param parent
*/
MainWindow::MainWindow(QWidget *parent):
    QMainWindow(parent)
{	
	m_pCentral = new QFrame;
	setCentralWidget(m_pCentral);

	m_mainLayout = new QHBoxLayout;
	m_mainLayout->setContentsMargins(1,1,1,1);
	m_mainLayout->setSpacing(1);
	centralWidget()->setLayout(m_mainLayout);
	m_mainLayout->addWidget(&m_accordion);
	m_accordion.setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);

	QAccordionItem *item = new QAccordionItem("Item1");
	QTableWidget *table = new QTableWidget();
	QTableWidgetItem *table_item = new QTableWidgetItem("Test talbe item");
	table->setColumnCount(1);
	table->setRowCount(1);
	table->setItem(0,0,table_item);
	item->setWidget(table);

	m_accordion.addItem(item);		

	QAccordionItem *item2 = new QAccordionItem("Item2");
	QLineEdit *lineEdit = new QLineEdit();
	lineEdit->setText("Testing Text");
	item2->setWidget(lineEdit);
	m_accordion.addItem(item2);		
	createInnerAccordion();

}
示例#2
0
void Table::setColumnCount(int count, bool suppressSignals)
{
    QTableWidget *tablewidget = static_cast<QTableWidget*>(getQWidget());
    bool oldSignalsState = tablewidget->blockSignals(suppressSignals);
    tablewidget->setColumnCount(count);
    tablewidget->blockSignals(oldSignalsState);
}
unsigned StManagerStudyListComp::getSeriesIndex( const SerieInfoVector info )
{
  // no resize, just exit button - reject, result code is 0 -> returned value will be 0
  QDialog *seriesSelectorDialog = new QDialog( this, Qt::WindowTitleHint | Qt::WindowSystemMenuHint| Qt::MSWindowsFixedSizeDialogHint );
  seriesSelectorDialog->setWindowTitle( tr( "Series Selector" ) );

  QVBoxLayout *mainLayout = new QVBoxLayout;

  QLabel *seriesLabel = new QLabel( tr( "Series in selected study:\n(their descriptions)" ) );
  mainLayout->addWidget( seriesLabel );

  QSpacerItem *verticalSpacer = new QSpacerItem( 2, 10, QSizePolicy::Minimum, 
                                                 QSizePolicy::Minimum );
  mainLayout->addItem( verticalSpacer );

  QTableWidget *seriesTable = createSeriesSelectionTable();
  seriesTable->setRowCount( info.size() );
  for ( unsigned i = 0; i < info.size(); i++ ) {
    seriesTable->setItem( i, 0, new QTableWidgetItem( QString( info[i].description.c_str() ) ) );
  }
  connect( seriesTable, SIGNAL(cellClicked( int, int )), seriesSelectorDialog, SLOT(done( int )) );
  mainLayout->addWidget( seriesTable );

  seriesSelectorDialog->setLayout( mainLayout );

  return seriesSelectorDialog->exec();
}
示例#4
0
void ListingTracePane::updateListingTrace()
{
    // tableWidget depends on whether we are in the OS or a program
    QTableWidget *tableWidget;
    if (Sim::trapped) {
        tableWidget = ui->listingPepOsTraceTableWidget;
        ui->listingPepOsTraceTableWidget->show();
        ui->listingTraceTableWidget->hide();
    }
    else {
        tableWidget = ui->listingTraceTableWidget;
        ui->listingPepOsTraceTableWidget->hide();
        ui->listingTraceTableWidget->show();
    }

    for (int i = highlightedItemList.size() - 1; i >= 0; i--) {
        highlightedItemList.at(i)->setBackgroundColor(Qt::white);
        highlightedItemList.at(i)->setTextColor(Qt::black);
        highlightedItemList.removeLast();
    }
    if (Pep::memAddrssToAssemblerListing->contains(Sim::programCounter)) {
        QTableWidgetItem *highlightedItem = tableWidget->item(Pep::memAddrssToAssemblerListing->value(Sim::programCounter), 1);
        highlightedItem->setBackgroundColor(QColor(56, 117, 215));
        highlightedItem->setTextColor(Qt::white);
        highlightedItemList.append(highlightedItem);

        tableWidget->scrollToItem(highlightedItem);
    }
    tableWidget->horizontalScrollBar()->setValue(tableWidget->horizontalScrollBar()->minimum());
}
示例#5
0
HttpUserSetupDialog::HttpUserSetupDialog(QWidget *parent)
	: QDialog(parent)
	, ui(new Ui::HttpUserSetupDialog)
{
	ui->setupUi(this);
	
	QTableWidget * tableWidget = ui->httpUsers;
	QList<HttpUser*> users = HttpUserUtil::instance()->users();
	
	tableWidget->setRowCount(users.size());
	int row = 0;
	foreach(HttpUser *user, users)
	{
		tableWidget->setItem(row, 0, new QTableWidgetItem(user->user()));
		tableWidget->setItem(row, 1, new QTableWidgetItem(user->pass()));
		tableWidget->setItem(row, 2, new QTableWidgetItem(QString::number(user->level())));
		
		QComboBox *levelCombo = new QComboBox();
		
		levelCombo->addItems(QStringList() << "Guest" << "User" << "Admin");
		levelCombo->setCurrentIndex(user->level());
		
		tableWidget->setCellWidget(row, 2, levelCombo);
		 
		row ++;
	}
示例#6
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;
}
示例#7
0
void ParameterWin::somethingChanged(QTableWidgetItem *twi)
{
    QSettings settings("DoLong Inc", "Command");

    QVector <command_attr_t *> cVector;
    QString tabName = tabWidget->tabText(tabWidget->currentIndex());

    for (int j = 0; j < Command::commandSize(); ++j) {
        if (userCommand[j].tableName == tabName) {
            cVector.append(&userCommand[j]);
        }
    }

    QTableWidget * tableWidget = twi->tableWidget();
    int whichitem = tableWidget->rowCount() * twi->column() + twi->row();
    QString string = cVector.at(whichitem)->commandName;

    cVector.at(whichitem)->paraValue = twi->text();
    if (cVector.at(whichitem)->paraAttr & SAVE) { //存储数据
        settings.setValue(string, twi->text());
    }
    float value = twi->text().toFloat();
    int setValue = value * cVector.at(whichitem)->paraCoe;
    //serialPortThread->addTransaction(requestToByteArray(string, QString::number(setValue)));
    emit sendData(Command::requestToByteArray(string, QString::number(setValue)));
    qDebug() << string << "= " << QString::number(setValue);
}
示例#8
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();
  }
}
示例#9
0
void MainWindow::on_spinAccount_valueChanged(int arg1)
{
    if (!root_set) return;
    const char addr_version = 0x00, wif_version = 0x80;
    const size_t buflen = 128;
    char buf[buflen + 1];
    HDNode node;
    // external chain
    for (int chain = 0; chain < 2; chain++) {
        QTableWidget *list = chain == 0 ? ui->listAddress : ui->listChange;
        node = root;
        hdnode_private_ckd(&node, 44 | 0x80000000);
        hdnode_private_ckd(&node, 0 | 0x80000000); // bitcoin
        hdnode_private_ckd(&node, (arg1 - 1) | 0x80000000);
        hdnode_serialize_private(&node, buf, buflen); QString xprv = QString(buf); ui->lineXprv->setText(xprv);
        hdnode_serialize_public(&node, buf, buflen); QString xpub = QString(buf); ui->lineXpub->setText(xpub);
        hdnode_private_ckd(&node, chain); // external / internal
        for (int i = 0; i < 100; i++) {
            HDNode node2 = node;
            hdnode_private_ckd(&node2, i);
            ecdsa_get_address(node2.public_key, addr_version, buf, buflen); QString address = QString(buf);
            ecdsa_get_wif(node2.private_key, wif_version, buf, buflen); QString wif = QString(buf);
            list->setItem(i, 0, new QTableWidgetItem(address));
            list->setItem(i, 1, new QTableWidgetItem(wif));
            list->setItem(i, 2, new QTableWidgetItem("0.0"));
        }
    }
}
示例#10
0
AppHistoryTab::AppHistoryTab()
{

    //

    QLabel *legendLabel = new QLabel("Historique des applications depuis la connexion au serveur.");
    legendLabel->setFixedHeight(40);


    // TabWidget

    QTableWidget *tableWidget = new QTableWidget();
    tableWidget->setColumnCount(6);

    // resize to contents
    tableWidget->setColumnWidth(0, 300);

    QStringList listHeaders;
    listHeaders << "Nom" << "PID" << "Statut" << "UID" << "Date de début" << "Date de fin";
    tableWidget->setHorizontalHeaderLabels(listHeaders);
    tableWidget->horizontalHeaderItem(0)->setTextAlignment(Qt::AlignLeft);


    // Layering

    QVBoxLayout *vl = new QVBoxLayout();
    setLayout(vl);
    vl->addWidget(legendLabel);
    vl->addWidget(tableWidget);
}
void MainWindow::on_showMoreButton_clicked()
{
        if(currSelectedID.toInt() > 0){
            QString imgPath = "images/";
            QTableWidget *current = new QTableWidget;
            if(whatList){
                ui->listOfSci->setHidden(1);
                imgPath += "scientists/";
                current = ui->listOfSci;
            }
            else{
                ui->listOfComps->setHidden(1);
                imgPath += "computers/";
                current = ui->listOfComps;
            }

            imgPath += currSelectedID + ".jpg";
            QPixmap thing(imgPath);
            ui->pictureLable->setScaledContents(true);
            ui->pictureLable->setPixmap(thing);

            displayConnections(currSelectedID);
            fillComboConn();

            int row = currSelectedRow;
            ui->more1->setText(current->item(row, 1)->text());
            ui->more2->setText(current->item(row, 2)->text());
            ui->more3->setText(current->item(row, 3)->text());
            ui->more4->setText(current->item(row, 4)->text());
            ui->more5->setText(current->item(row, 5)->text());
            ui->moreUI->setVisible(1);
    }

    return;
}
示例#12
0
void MainWindow::clearObjectTable()
{
    QTableWidget *table = ui->objectsTableWidget;
    table->clear();
    table->setRowCount(0);
    table->setColumnCount(0);
}
// Slot.
void
TransitionEditorWindow::createPoint(unsigned int pointType, float time, float value)
{
	if (model_ == nullptr) return;
	if (transition_ == nullptr) return;
	if (pointType < 2 || pointType > 4) {
		qCritical("Invalid point type: %u", pointType);
		return;
	}

	TransitionPoint newPoint;
	newPoint.type = static_cast<TRMControlModel::Transition::Point::Type>(pointType);
	newPoint.value = value;
	newPoint.freeTime = time;

	QTableWidget* table = ui_->pointsTable;
	if (table->rowCount() == 0) {
		pointList_.push_back(std::move(newPoint));
	} else {
		// Insert point at the end of the group.
		auto iter = pointList_.begin();
		auto end = pointList_.end();
		while (iter != end && static_cast<unsigned int>(iter->type) <= pointType) {
			++iter;
		}
		pointList_.insert(iter, std::move(newPoint));
	}

	updateTransition();

	ui_->pointsTable->setCurrentItem(nullptr);
	ui_->equationsTree->setCurrentItem(nullptr);
}
示例#14
0
void Table::setSelection(int row, int column, bool suppressSignals)
{
    QTableWidget *tablewidget = static_cast<QTableWidget*>(getQWidget());
    bool oldSignalsState = tablewidget->blockSignals(suppressSignals);
    tablewidget->setCurrentCell(row, column);
    tablewidget->blockSignals(oldSignalsState);
}
示例#15
0
ServerTab::ServerTab()
{
    //
    QLabel *legendLabel = new QLabel("Liste des clients connectés au serveur.");
    legendLabel->setFixedHeight(40);

    // TabWidget

    QTableWidget *tableWidget = new QTableWidget();
    tableWidget->setColumnCount(6);

    // resize to contents
    tableWidget->setColumnWidth(0, 300);
    tableWidget->setColumnWidth(4, 120);

    QStringList listHeaders;
    listHeaders << "Nom du client" << "ID de connexion" << "Adresse IP" << "Statut" << "Début de connexion" << "Fin de connexion";
    tableWidget->setHorizontalHeaderLabels(listHeaders);
    tableWidget->horizontalHeaderItem(0)->setTextAlignment(Qt::AlignLeft);


    // Layering

    QVBoxLayout *vl = new QVBoxLayout();
    setLayout(vl);
    vl->addWidget(legendLabel);
    vl->addWidget(tableWidget);
}
示例#16
0
// get speaker's themes by language
QTableWidget *PublicTalks::getSpeakerPublicTalks(int kieli_id, int personid, QString select) {
    QTableWidget *table = new QTableWidget(0,3);
    table->verticalHeader()->setVisible(false);

    //sitten vectoriin kaikki aiheet
    std::vector<sql_item> q;
//    q = sql.selectSql("SELECT * FROM Esitelmat, P_esitelmat WHERE Esitelmat.kieli_id = '"+ kielet[0].getValue("id") +"'"
//                      " AND Esitelmat.aihe_id = P_esitelmat.aihe_id"
//                      " AND P_esitelmat.puhuja_id = '" + QString::number(personid) + "'");
    q = sql.selectSql("SELECT Esitelmat.*, P_esitelmat.puhuja_id, yleisokokous.pvm FROM Esitelmat "
                      "LEFT JOIN yleisokokous ON Esitelmat.aihe_id = yleisokokous.aihe_id "
                      "LEFT JOIN P_esitelmat ON Esitelmat.aihe_id = P_esitelmat.aihe_id "
                      "WHERE P_esitelmat.puhuja_id = '" + QString::number(personid) + "' "
                      "AND Esitelmat.kieli_id = '"+ langId +"' "
                      "GROUP BY Esitelmat.aihe_id ORDER BY Esitelmat.aihe_id");
    table->setRowCount(q.size()+1);
    for(unsigned int i = 0; i < q.size(); i++) {

        int value = QVariant(q[i].getValue("aihe_id")).toInt();
        QTableWidgetItem *item = new QTableWidgetItem();
        item->setData(Qt::DisplayRole,value);
        table->setItem(i+1,0,item);
        //table->setItem(i+1,0,new QTableWidgetItem(q[i].getValue("aihe_id")));
        table->setItem(i+1,1,new QTableWidgetItem(q[i].getValue("aihe")));
        if(table->item(i+1,1)->text() == select) {
            QFont boldfont(table->item(i+1,1)->font().family(),
                           table->item(i+1,1)->font().pointSize(),
                           QFont::Bold);
            table->item(i+1,1)->setFont(boldfont);
        }
        table->setItem(i+1,2,new QTableWidgetItem(q[i].getValue("pvm")));
    }

    return table;
}
int FAT_IRSALIYE_SATIR_SECIMI::SINGLE_LINE_SELECTED ( int p_selected_row_number )
{
    QTableWidget * tableWidget = GET_TABLE_WIDGET();

    *m_secilen_id = tableWidget->item ( p_selected_row_number, IRSALIYE_SATIRI_ID_COLUMN )->text().toInt();
    return ADAK_EXIT;
}
示例#18
0
void PublicTalks::beforePublicTalkComboBoxShown(int rownumber)
{
    // themes combobox
    cPersonComboBox *c = static_cast<cPersonComboBox *>(maintable->cellWidget(rownumber,2));
    cPersonComboBox *speakerCombo = static_cast<cPersonComboBox *>(maintable->cellWidget(rownumber,3));

    QString currentThemeText = c->currentText();
    QTableWidget *table;
    cpersons cp;
    person *speaker = cp.getPerson(speakerCombo->currentText());
    if (speaker) {
        // the speaker selected --> will be shown speaker's themes
        table = this->getSpeakerPublicTalks(0,speaker->id, currentThemeText);
    } else {
        // no speaker selected  --> all themes will be shown
        table = this->getPublicTalksbyLang(currentThemeText);
    }

    //    schoolComboBox *sc = static_cast<schoolComboBox *>(ui->tableSchoolEdit->cellWidget(row,col));
    qDebug() << QString::number(table->rowCount());
    table->setSortingEnabled(true);
    table->sortByColumn(0,Qt::AscendingOrder);
    table->verticalHeader()->hide();
    table->setColumnWidth(0,40);
    table->setColumnWidth(1,200);
    table->setColumnWidth(2,80);
    table->setMinimumWidth(340);
    c->clear();
    c->setModel(table->model());
    c->setView(table);
    c->setModelColumn(1);

    c->setCurrentIndex(c->findText(currentThemeText,Qt::MatchExactly));
}
示例#19
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)));
}
示例#20
0
IRS_IADE_IRSALIYE_SECIMI::IRS_IADE_IRSALIYE_SECIMI ( QString p_irsaliye_tarihi, int p_cari_hesap_id, int p_irsaliye_alis_satis_turu,int p_irsaliye_turu, QWidget * p_parent ) : SECIM_KERNELI ( p_parent )
{
    SET_HELP_PAGE ("irs_iade_irsaliye_secimi.html");

    m_irsaliye_tarihi_bitis     = p_irsaliye_tarihi;
    m_cari_hesap_id             = p_cari_hesap_id;
    m_irsaliye_alis_satis_turu  = p_irsaliye_alis_satis_turu;
    m_irsaliye_turu             = p_irsaliye_turu;


    SET_WINDOW_SIZE     ( 300, 500 );
    SET_SORTING         ( false );
    SET_HEADERS         ( QStringList() << tr("irsaliye_id") << tr("İrsaliye No") <<tr("İrs. Seri No")
                                        << tr("İrs. Tarihi") );

    INIT_KERNEL         ( DB );

    QTableWidget * tableWidget = GET_TABLE_WIDGET();

    tableWidget->setColumnWidth ( FIS_NO_COLUMN,                    100 );
    tableWidget->setColumnWidth ( IRSALIYE_BELGE_SERI_NO_COLUMN,    100 );
    tableWidget->setColumnWidth ( IRSALIYE_TARIHI_COLUMN,           100 );

    SET_SETTING_NAME            ( "IRS_IADE_IRSALIYE_SECIMI" );

    SET_PAGE_TITLE              ( tr ( "İRS - İADE İRSALİYE SEÇİMİ" ) );

    tableWidget->hideColumn     ( 0 );

}
示例#21
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;
}
STOK_GIDEN_PARTI_NO_SECIMI::STOK_GIDEN_PARTI_NO_SECIMI( int p_depo_id, int p_urun_id, int p_secili_parti_no, QWidget * parent ) : SECIM_KERNELI ( parent )
{
    m_depo_id = p_depo_id;
    m_urun_id = p_urun_id;

    SET_SORTING(false);
    SET_WINDOW_SIZE ( 300, 700 );
    QString urun_adi;
    STK_GET_URUN_KODU_ADI( p_urun_id, NULL, &urun_adi );

    SET_HEADERS ( QStringList()<<tr("part_no_id")<<tr("Parti Kodu")<<tr("Ürün Miktarı") << tr("Üretim Tarihi") << tr("Son K. Tarihi"));

    SET_PAGE_TITLE    ( "PARTİ KODU SEÇİMİ" );
    SET_SETTING_NAME  ( "STOK_GIDEN_PARTI_NO_SECIMI" );
    SET_HELP_PAGE     ( tr("stok_giden_parti_no_secimi.html") );

    INIT_KERNEL ( DB );

    QTableWidget * tablewidget = GET_TABLE_WIDGET();

    tablewidget->hideColumn(0);

    tablewidget->setColumnWidth( 1 , 40);
    tablewidget->setColumnWidth( 2 , 20);
    tablewidget->setColumnWidth( 3 , 20);
    tablewidget->setColumnWidth( 4 , 20);

    QList< int > secili_olacak_id;
    secili_olacak_id << p_secili_parti_no;
    SELECT_LINES( secili_olacak_id );
}
示例#23
0
void ShortcutsWidget::loadShortcuts(const QSettings &settings)
{
    MenuItems items = menuItems();
    ::loadShortcuts(&items, settings);

    m_actions.clear();
    m_shortcuts.clear();

    QTableWidget *table = ui->tableWidget;
    while (table->rowCount() > 0)
        table->removeRow(0);

    for (const auto &item : items) {
        MenuAction action;
        action.iconName = item.iconName;
        action.iconId = item.iconId;
        action.text = item.text;
        action.settingsKey = item.settingsKey;

        addShortcutRow(action);

        action.shortcutButton->setDefaultShortcut(item.defaultShortcut);
        for (const auto &shortcut : item.shortcuts)
            action.shortcutButton->addShortcut(shortcut);
    }

    addCommands( loadAllCommands() );
    addCommands( predefinedCommands() );
}
示例#24
0
void Player::playPrevious()
{
    stop();
    _isPaused = false;

    int r;
    QTableWidget *widget = 0;
//    QList<Track*> *playlist = 0;
//    Track *track = 0;

    if (_ui->tabWidget->currentWidget() == _ui->libraryTab)
    {
        widget = _ui->tracks;
//        playlist = &_libTracks;
    }
    else
    {
        widget = _ui->playlist;
//        playlist = &_plistTracks;
    }

    r = widget->currentRow();
    if (r <= 0)
        return;

    widget->setCurrentCell(--r, 0);
    play();
}
示例#25
0
void ItemTagsLoader::addTagToSettingsTable(const ItemTagsLoader::Tag &tag)
{
    QTableWidget *t = ui->tableWidget;

    const int row = t->rowCount();

    t->insertRow(row);
    t->setItem( row, tagsTableColumns::name, new TagTableWidgetItem(tag.name) );
    t->setItem( row, tagsTableColumns::match, new QTableWidgetItem(tag.match) );
    t->setItem( row, tagsTableColumns::styleSheet, new QTableWidgetItem(tag.styleSheet) );
    t->setItem( row, tagsTableColumns::color, new QTableWidgetItem() );
    t->setItem( row, tagsTableColumns::icon, new QTableWidgetItem() );

    auto colorButton = new QPushButton(t);
    const QColor color = tag.color.isEmpty()
            ? QColor::fromRgb(50, 50, 50)
            : deserializeColor(tag.color);
    setColorIcon(colorButton, color);
    t->setCellWidget(row, tagsTableColumns::color, colorButton);
    connect(colorButton, &QAbstractButton::clicked, this, &ItemTagsLoader::onColorButtonClicked);

    auto iconButton = new IconSelectButton(t);
    iconButton->setCurrentIcon(tag.icon);
    t->setCellWidget(row, tagsTableColumns::icon, iconButton);
    connect(iconButton, &IconSelectButton::currentIconChanged, this, &ItemTagsLoader::onAllTableWidgetItemsChanged);

    onTableWidgetItemChanged(t->item(row, 0));
}
示例#26
0
void Player::playNext()
{
    stop();
    _isPaused = false;

    int r;
    QTableWidget *widget = 0;
    QList<Track*> *playlist = 0;
//    Track *track = 0;

    if (_ui->tabWidget->currentWidget() == _ui->libraryTab)
    {
        widget = _ui->tracks;
        playlist = &_libTracks;
    }
    else
    {
        widget = _ui->playlist;
        playlist = &_plistTracks;
    }

    r = widget->currentRow() + 1;
    if (r >= playlist->size())
        return;

    widget->setCurrentCell(r, 0);
    play();
}
示例#27
0
void SkillEditFrame::onCurrentItemChanged(DataContainerItem *current) {
	if (current == 0)
		return;
	QTableWidget *skillTable = this->findChild<QTableWidget *>("skillTable");
	DataContainerItem *item = current;
	if (item->getStringData().size() > 0) {
		StatsContainer *skill = GenStatsReader::getContainer(*skillStats, item->getStringData());
		if (skill != 0) {
			typedef std::map<std::string, std::string> StringMap;
			StringMap dataMap = skill->getBaseDataMap();
			for (int i=0; i<skillTable->rowCount(); ++i) {
				for (int j=0; j<skillTable->columnCount(); ++j) {
					delete skillTable->item(i, j);
				}
			}
			
			skillTable->setRowCount(0);
			int row = 0;
			for (StringMap::iterator it = dataMap.begin(); it != dataMap.end(); ++it) {
				QTableWidgetItem *nameItem = new QTableWidgetItem();
				nameItem->setText(it->first.c_str());
				QTableWidgetItem *valueItem = new QTableWidgetItem();
				valueItem->setText(it->second.c_str());
				skillTable->insertRow(row);
				skillTable->setItem(row, 0, nameItem);
				skillTable->setItem(row, 1, valueItem);
				++row;
			}

			skillTable->resizeRowsToContents();
			skillTable->resizeColumnsToContents();
		}
	}
}
示例#28
0
QWidget* FormUiLoader::createWidget( const QString& className, QWidget* parent, const QString& name)
{
	if (className == "QTreeWidget")
	{
		QTreeWidget* rt = new WidgetWithDragAndDrop<QTreeWidget>( m_dataLoader, parent, name, m_debug);
		rt->setDragEnabled( true);
		rt->showDropIndicator();
		return rt;
	}
	else if (className == "QListWidget")
	{
		QListWidget* rt = new WidgetWithDragAndDrop<QListWidget>( m_dataLoader, parent, name, m_debug);
		rt->setDragEnabled( true);
		rt->showDropIndicator();
		return rt;
	}
	else if (className == "QTableWidget")
	{
		QTableWidget* rt = new WidgetWithDragAndDrop<QTableWidget>( m_dataLoader, parent, name, m_debug);
		rt->setDragEnabled( true);
		return rt;
	}
	else
	{
		return QUiLoader::createWidget( className, parent, name);
	}
}
示例#29
0
void CocktailDialog::initQTablaWidget()
{
    ui->lineEditNomeCocktail->setText (QString::fromStdString (c->getNomeCocktail ()));
    ui->lineEditMomCons->setText (QString::fromStdString (c->getMomentoConsumo ()));

    Drink* d  = c->getDrink ();


    QTableWidget* tw = ui->tableIngridientiWidget;

    int s = d->howManyElements ();

for (int i = 0; i < s; ++i)
{
    tw->insertRow (i);
    QTableWidgetItem* itemTipo  = new QTableWidgetItem;
    QTableWidgetItem* itemNome  = new QTableWidgetItem;
    QTableWidgetItem* itemQuantita  = new QTableWidgetItem;
    QTableWidgetItem* itemPalc  = new QTableWidgetItem;


    itemTipo->setData (0, QVariant(QString::fromStdString (d->getChild (i)->getTipo ())));
    itemNome->setData (0, QVariant(QString::fromStdString (d->getChild (i)->getNome ())));
    itemQuantita->setData(0, QVariant(QString::number (d->getChild (i)->volume ())));
    itemPalc->setData(0, QVariant(QString::number (d->getChild (i)->getPercentualeAlcolica ())));

    tw->setItem (i, 0, itemTipo);
    tw->setItem (i, 1, itemNome);
    tw->setItem (i, 2, itemQuantita);
    tw->setItem (i, 3, itemPalc);
 }
}
示例#30
0
void Table::clear(bool suppressSignals)
{
    QTableWidget *tablewidget = static_cast<QTableWidget*>(getQWidget());
    bool oldSignalsState = tablewidget->blockSignals(suppressSignals);
    tablewidget->clear(); // or clearContents() ?
    tablewidget->blockSignals(oldSignalsState);
}