void interface_impl::SLOT_ajouter_regle()
{
// Adding a new row in my QTableWidget
tableau_regles->setRowCount(tableau_regles->rowCount() + 1);
// Creating the item 1/6 for this row (A checkbox)
Item_0->setCheckState(Qt::Unchecked);
Item_0->setFlags(Item_0->flags() & (~(Qt::ItemIsEditable)));
// Creating the item 2/6 for this row (Just a message)
// Creating the item 3/6 for this row (An input field)
// Creating the item 4/6 for this row (Just a message)
// Creating the item 5/6 for this row (Another input field)
// Creating the item 6/6 for this row (A list of choices)
liste_section->addItem("uniquement en début de nom", "start");
liste_section->addItem("partout dans le nom", "full");
liste_section->addItem("uniquement en fin de nom", "end");
liste_section->setCurrentIndex(1);
//liste_section->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon);
liste_section
->setSizeAdjustPolicy
(QComboBox::AdjustToContents);
// Adding items 1 to 6 in the new row of the QTableWidget :
tableau_regles->setItem(tableau_regles->rowCount()-1, 0, Item_0);
tableau_regles->setItem(tableau_regles->rowCount()-1, 1, Item_1);
tableau_regles->setCellWidget(tableau_regles->rowCount()-1, 2, ancienne_valeur);
tableau_regles->setItem(tableau_regles->rowCount()-1, 3, Item_3);
tableau_regles->setCellWidget(tableau_regles->rowCount()-1, 4, nouvelle_valeur);
tableau_regles->setCellWidget(tableau_regles->rowCount()-1, 5, liste_section);
// Resizing each column to the content
resizer_tableaux();
}
void interface_impl::SLOT_ajouter_regle()
{
// Adding a new row in my QTableWidget
tableau_regles->setRowCount(tableau_regles->rowCount() + 1);
// Creating the item 1/6 for this row (A checkbox)
QTableWidgetItem *Item_0 = new QTableWidgetItem("");
Item_0->setCheckState(Qt::Unchecked);
Item_0->setFlags(Item_0->flags() & (~(Qt::ItemIsEditable)));
// Creating the item 2/6 for this row (Just a message)
QTableWidgetItem *Item_1 = new QTableWidgetItem("Remplacer");
// Creating the item 3/6 for this row (An input field)
QLineEdit *ancienne_valeur = new QLineEdit("");
// Creating the item 4/6 for this row (Just a message)
QTableWidgetItem *Item_3 = new QTableWidgetItem("par");
// Creating the item 5/6 for this row (Another input field)
QLineEdit *nouvelle_valeur = new QLineEdit("");
// Creating the item 6/6 for this row (A list of choices)
QComboBox *liste_section = new QComboBox();
liste_section->addItem("uniquement en début de nom", "start");
liste_section->addItem("partout dans le nom", "full");
liste_section->addItem("uniquement en fin de nom", "end");
liste_section->setCurrentIndex(1);
//liste_section->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon);
liste_section->setSizeAdjustPolicy(QComboBox::AdjustToContents);
// Adding items 1 to 6 in the new row of the QTableWidget :
tableau_regles->setItem(tableau_regles->rowCount()-1, 0, Item_0);
tableau_regles->setItem(tableau_regles->rowCount()-1, 1, Item_1);
tableau_regles->setCellWidget(tableau_regles->rowCount()-1, 2, ancienne_valeur);
tableau_regles->setItem(tableau_regles->rowCount()-1, 3, Item_3);
tableau_regles->setCellWidget(tableau_regles->rowCount()-1, 4, nouvelle_valeur);
tableau_regles->setCellWidget(tableau_regles->rowCount()-1, 5, liste_section);
// Resizing each column to the content
resizer_tableaux();
}
To copy to clipboard, switch view to plain text mode
void interface_impl::resizer_tableaux()
{
tableau_regles->update();
tableau_regles->resizeColumnToContents(0);
tableau_regles->resizeColumnToContents(1);
tableau_regles->resizeColumnToContents(2);
tableau_regles->resizeColumnToContents(3);
tableau_regles->resizeColumnToContents(4);
tableau_regles->resizeColumnToContents(5);
}
void interface_impl::resizer_tableaux()
{
tableau_regles->update();
tableau_regles->resizeColumnToContents(0);
tableau_regles->resizeColumnToContents(1);
tableau_regles->resizeColumnToContents(2);
tableau_regles->resizeColumnToContents(3);
tableau_regles->resizeColumnToContents(4);
tableau_regles->resizeColumnToContents(5);
}
To copy to clipboard, switch view to plain text mode
Bookmarks