コード例 #1
0
ファイル: searchitemdelegate.cpp プロジェクト: fk1392/Saaghar
void SaagharItemDelegate::keywordChanged(const QString &text)
{
    keywordList.clear();
    QString tmp = text;
    tmp.replace(QChar(0x200C), "", Qt::CaseInsensitive);//replace ZWNJ by ""
    keywordList = SearchPatternManager::phraseToList(tmp, false);
    keywordList.removeDuplicates();

    QTableWidget* table = qobject_cast<QTableWidget*>(parent());
    if (table) {
        table->viewport()->update();
    }
}
コード例 #2
0
ファイル: main.cpp プロジェクト: MarianMMX/MarianMMX
int main(int argc, char **argv)
{
    QApplication app(argc, argv);
    QTableWidget tableWidget;
//    tableWidget.setAttribute(Qt::WA_StaticContents);
    tableWidget.viewport()->setAttribute(Qt::WA_StaticContents);
    tableWidget.setRowCount(15);
    tableWidget.setColumnCount(4);
    for (int row = 0; row  < 15; ++row)
    for (int col = 0; col  < 4; ++col)
//        tableWidget.setCellWidget(row, col, new StaticWidget());
       tableWidget.setCellWidget(row, col, new CellWidget());
    tableWidget.resize(400, 600);
    tableWidget.show();

    return app.exec();
}
コード例 #3
0
void MoleculeListDock::customContextMenuRequested(const QPoint &pos)
{
    QTableWidget *tableWidget = ui->tableWidget;

    QTableWidgetItem *item = tableWidget->itemAt(pos);
    if(!item)
        return;

    QMenu menu;
    QAction *renameAction = menu.addAction("Rename");
    connect(renameAction, SIGNAL(triggered()), this, SLOT(renameMolecule()));
    QAction *deleteAction = menu.addAction("Delete");
    connect(deleteAction, SIGNAL(triggered()), this, SLOT(deleteMolecule()));
    QAction *propertiesAction = menu.addAction("Properties");
    connect(propertiesAction, SIGNAL(triggered()), this, SLOT(showMoleculeProperties()));

    menu.exec(tableWidget->viewport()->mapToGlobal(pos));
}