コード例 #1
0
void receivecoinsdialog::setmodel(walletmodel *model)
{
    this->model = model;

    if(model && model->getoptionsmodel())
    {
        model->getrecentrequeststablemodel()->sort(recentrequeststablemodel::date, qt::descendingorder);
        connect(model->getoptionsmodel(), signal(displayunitchanged(int)), this, slot(updatedisplayunit()));
        updatedisplayunit();

        qtableview* tableview = ui->recentrequestsview;

        tableview->verticalheader()->hide();
        tableview->sethorizontalscrollbarpolicy(qt::scrollbaralwaysoff);
        tableview->setmodel(model->getrecentrequeststablemodel());
        tableview->setalternatingrowcolors(true);
        tableview->setselectionbehavior(qabstractitemview::selectrows);
        tableview->setselectionmode(qabstractitemview::contiguousselection);
        tableview->setcolumnwidth(recentrequeststablemodel::date, date_column_width);
        tableview->setcolumnwidth(recentrequeststablemodel::label, label_column_width);

        connect(tableview->selectionmodel(),
            signal(selectionchanged(qitemselection, qitemselection)), this,
            slot(recentrequestsview_selectionchanged(qitemselection, qitemselection)));
        // last 2 columns are set by the columnresizingfixer, when the table geometry is ready.
        columnresizingfixer = new guiutil::tableviewlastcolumnresizingfixer(tableview, amount_minimum_column_width, date_column_width);
    }
コード例 #2
0
ファイル: librarywidget.cpp プロジェクト: KDE/conquirere
void LibraryWidget::setupUi()
{
    ui->treeWidget->setItemDelegate(new ProjectTreeDelegate());
    connect(ui->treeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(selectionchanged()));

    ui->treeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(ui->treeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(listContextMenu(QPoint)));

    QLibraryTreeWidgetItem *root = new QLibraryTreeWidgetItem();
    root->setData(0,BibGlobals::Role_ResourceType,BibGlobals::Resource_SearchResults);
    root->setIcon(0, KIcon(QLatin1String("system-search")));
    ui->treeWidget->addTopLevelItem(root);

    root->setText(0, i18n("Search Results"));

    connect(ui->searchWidget, SIGNAL(newSearchStarted()), this, SIGNAL(showSearchResults()));
}