コード例 #1
0
BrowseTableModel::BrowseTableModel(QObject* parent,
                                   TrackCollection* pTrackCollection,
                                   RecordingManager* pRecordingManager)
        : TrackModel(pTrackCollection->getDatabase(),
                     "mixxx.db.model.browse"),
          QStandardItemModel(parent),
          m_pTrackCollection(pTrackCollection),
          m_pRecordingManager(pRecordingManager) {
    QStringList header_data;
    header_data.insert(COLUMN_FILENAME, tr("Filename"));
    header_data.insert(COLUMN_ARTIST, tr("Artist"));
    header_data.insert(COLUMN_TITLE, tr("Title"));
    header_data.insert(COLUMN_ALBUM, tr("Album"));
    header_data.insert(COLUMN_TRACK_NUMBER, tr("Track #"));
    header_data.insert(COLUMN_YEAR, tr("Year"));
    header_data.insert(COLUMN_GENRE, tr("Genre"));
    header_data.insert(COLUMN_COMPOSER, tr("Composer"));
    header_data.insert(COLUMN_COMMENT, tr("Comment"));
    header_data.insert(COLUMN_DURATION, tr("Duration"));
    header_data.insert(COLUMN_BPM, tr("BPM"));
    header_data.insert(COLUMN_KEY, tr("Key"));
    header_data.insert(COLUMN_TYPE, tr("Type"));
    header_data.insert(COLUMN_BITRATE, tr("Bitrate"));
    header_data.insert(COLUMN_LOCATION, tr("Location"));

    addSearchColumn(COLUMN_FILENAME);
    addSearchColumn(COLUMN_ARTIST);
    addSearchColumn(COLUMN_ALBUM);
    addSearchColumn(COLUMN_TITLE);
    addSearchColumn(COLUMN_GENRE);
    addSearchColumn(COLUMN_COMPOSER);
    addSearchColumn(COLUMN_KEY);
    addSearchColumn(COLUMN_COMMENT);

    setHorizontalHeaderLabels(header_data);
    // register the QList<T> as a metatype since we use QueuedConnection below
    qRegisterMetaType< QList< QList<QStandardItem*> > >(
        "QList< QList<QStandardItem*> >");
    qRegisterMetaType<BrowseTableModel*>("BrowseTableModel*");

    connect(BrowseThread::getInstance(), SIGNAL(clearModel(BrowseTableModel*)),
            this, SLOT(slotClear(BrowseTableModel*)),
            Qt::QueuedConnection);

    connect(
        BrowseThread::getInstance(),
        SIGNAL(rowsAppended(const QList< QList<QStandardItem*> >&, BrowseTableModel*)),
        this,
        SLOT(slotInsert(const QList< QList<QStandardItem*> >&, BrowseTableModel*)),
        Qt::QueuedConnection);
}
コード例 #2
0
ファイル: actionrepository.cpp プロジェクト: Fale/qtmoko
// ----------- ActionModel
ActionModel::ActionModel(QWidget *parent ) :
    QStandardItemModel(parent),
    m_core(0)
{
    QStringList headers;
    headers += tr("Name");
    headers += tr("Used");
    headers += tr("Text");
    headers += tr("Shortcut");
    headers += tr("Checkable");
    headers += tr("ToolTip");
    Q_ASSERT(NumColumns == headers.size());
    setHorizontalHeaderLabels(headers);
}
コード例 #3
0
void CurrentPlayTable::setupTable()
{
    setColumnCount(3);

    QStringList headerLabels;
    headerLabels<<tr("客户端")<<tr("播放模式")<<tr("播放文件");
	setHorizontalHeaderLabels(headerLabels);
	horizontalHeader()->setStretchLastSection(true);
    verticalHeader()->hide();

    setEditTriggers(QAbstractItemView::NoEditTriggers);
    setSelectionBehavior(QAbstractItemView::SelectRows);
    setSelectionMode(QAbstractItemView::SingleSelection);

    PlayListCenter* playListCenter = g_DataCenter->createPlayListCenter();
    for(ClientGroup::Iterator it = m_ClientGroup->begin();
    it != m_ClientGroup->end();
    ++it)
    {
        boost::shared_ptr<SingleClient> client = *it;
        int clientId = client->getId();
        int orgRowCount = rowCount();
        std::vector<VideoFileInformation> playList;
        playListCenter->getNewestPlayList(clientId, playList);
        setRowCount(orgRowCount+1);
        setItem(orgRowCount, 0, new QTableWidgetItem( (*it)->getName() ));

        QString playFile;
        if(!client->getCurrentPlayFile(playFile,false))
        {
            setItem(orgRowCount, 1, new QTableWidgetItem(tr("未播放模式")));
        }
        else
        {
            QString filePath;
            client->getCurrentPlayFile(filePath,true);
            fileNameToPath[playFile] = filePath;
            if(client->getPlayMode() == SingleClient::RealTimeMode)
            {
                setItem(orgRowCount, 1, new QTableWidgetItem(tr("实时播放模式")));
            }
            else if(client->getPlayMode() == SingleClient::PlayListMode)
            {
                setItem(orgRowCount, 1, new QTableWidgetItem(tr("播放计划方式")));
            }
            setItem(orgRowCount, 2, new QTableWidgetItem(playFile));
        }
    }
}
コード例 #4
0
QgsOracleTableModel::QgsOracleTableModel()
    : QStandardItemModel()
    , mTableCount( 0 )
{
  QStringList headerLabels;
  headerLabels << tr( "Owner" );
  headerLabels << tr( "Table" );
  headerLabels << tr( "Type" );
  headerLabels << tr( "Geometry column" );
  headerLabels << tr( "SRID" );
  headerLabels << tr( "Primary key column" );
  headerLabels << tr( "Select at id" );
  headerLabels << tr( "Sql" );
  setHorizontalHeaderLabels( headerLabels );
}
コード例 #5
0
ファイル: TreeModel.cpp プロジェクト: GromeTT/KinectTracker
TreeModel::TreeModel( QObject* parent )
    : QStandardItemModel( parent )
    , mp_object( nullptr )
{
    m_updateSlot = metaObject()->method( metaObject()->indexOfSlot( "propertyChanged()" ) );

    // Set up the horizontal headers.
    setColumnCount( 3 );
    QStringList horizontalHeaders;
    horizontalHeaders << tr( "property" ) << tr( "value" ) << tr( "type" );
    setHorizontalHeaderLabels( horizontalHeaders );

    // Changes on item -> data
    connect( this, SIGNAL( itemChanged( QStandardItem* ) ), this, SLOT( slotItemChanged(QStandardItem*) ) );
}
コード例 #6
0
ファイル: historymodel.cpp プロジェクト: MellonQ/leechcraft
	HistoryModel::HistoryModel (QObject *parent)
	: QStandardItemModel { parent }
	{
		setHorizontalHeaderLabels ({tr ("Title"), tr ("URL"), tr ("Date") });
		QTimer::singleShot (0,
				this,
				SLOT (loadData ()));

		GarbageTimer_ = new QTimer (this);
		GarbageTimer_->start (15 * 60 * 1000);
		connect (GarbageTimer_,
				SIGNAL (timeout ()),
				this,
				SLOT (collectGarbage ()));
	}
コード例 #7
0
ファイル: qgspgtablemodel.cpp プロジェクト: cz172638/QGIS
QgsPgTableModel::QgsPgTableModel()
{
  QStringList headerLabels;
  headerLabels << tr( "Schema" );
  headerLabels << tr( "Table" );
  headerLabels << tr( "Comment" );
  headerLabels << tr( "Column" );
  headerLabels << tr( "Data Type" );
  headerLabels << tr( "Spatial Type" );
  headerLabels << tr( "SRID" );
  headerLabels << tr( "Feature id" );
  headerLabels << tr( "Select at id" );
  headerLabels << tr( "Sql" );
  setHorizontalHeaderLabels( headerLabels );
}
コード例 #8
0
NShortcutEditorWidget::NShortcutEditorWidget(QWidget *parent) : QTableWidget(parent)
{
    setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
    setColumnCount(4);
    setHorizontalHeaderLabels(QStringList() << tr("Action") << tr("Description") << tr("Shortcut") << tr("Global Shortcut"));

    verticalHeader()->setVisible(false);

    setEditTriggers(QAbstractItemView::NoEditTriggers);
    setSelectionMode(QAbstractItemView::SingleSelection);

    setStyleSheet("QTableView::item:disabled { color: black; }");

    m_init = false;
}
コード例 #9
0
    FeedWidget()
            : QTableWidget() {
        m_entries = 0;
        m_previewentries = 0;

        setRowCount(20);
        setColumnCount(5);

        QStringList headers;
        headers << "Name";
        headers << "Author";
        headers << "Downloads";
        headers << "Rating";
        headers << "Preview";
        setHorizontalHeaderLabels(headers);
    }
コード例 #10
0
ファイル: ValueTableWidget.cpp プロジェクト: JonECG/Raypoint
ValueTableWidget::ValueTableWidget()
{
    setColumnCount( 2 );
    QStringList list;
    list.append( tr( "Name" ) );
    list.append( tr( "Default" ) );
    setHorizontalHeaderLabels( list );

    setColumnWidth( 0, 65 );
    setColumnWidth( 1, 65 );

    horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);
    horizontalHeader()->setSectionsClickable( false );
    horizontalHeader()->setSelectionMode(QAbstractItemView::NoSelection);
    verticalHeader()->setVisible( false );
}
コード例 #11
0
TableWidgetDEV::TableWidgetDEV(const QStringList &headNames, QWidget *parent) :
    QTableWidget(parent)
{
    setColumnCount(headNames.size());
    setHorizontalHeaderLabels(headNames);
    //horizontalHeader()->setResizeMode(0,QHeaderView::Stretch);
    //horizontalHeader()->setResizeMode(1,QHeaderView::Stretch);
    setShowGrid(false);

    setSelectionBehavior(QAbstractItemView::SelectRows);

    unloadDev = new QAction(tr("unload"),this);
    addAction(unloadDev);
    setContextMenuPolicy(Qt::ActionsContextMenu);
    connect(unloadDev,SIGNAL(triggered()),this,SLOT(dounload()));
}
コード例 #12
0
ファイル: qgspgtablemodel.cpp プロジェクト: ACorradini/QGIS
QgsPgTableModel::QgsPgTableModel()
    : QStandardItemModel()
    , mTableCount( 0 )
{
  QStringList headerLabels;
  headerLabels << tr( "Schema" );
  headerLabels << tr( "Table" );
  headerLabels << tr( "Column" );
  headerLabels << tr( "Data Type" );
  headerLabels << tr( "Spatial Type" );
  headerLabels << tr( "SRID" );
  headerLabels << tr( "Primary Key" );
  headerLabels << tr( "Select at id" );
  headerLabels << tr( "Sql" );
  setHorizontalHeaderLabels( headerLabels );
}
コード例 #13
0
CMonitorProcesses::CMonitorProcesses( QWidget* pwidgetParent )
	: QTableWidget( pwidgetParent )
{
    setToolTip( tr( "list of processes currently owning one or more ODBC handles" ) );
    setWhatsThis( tr( "This shows a list of processes currently owning one or more ODBC handles. The number of handles are shown. This is revised frequently while in view. This is useful for debugging and monitoring performance." ) );

    // lets assume, for the moment, that we can get monitoring info from DM...
    bEnabled = true;

    // setup table...
    {
        // we remember rows from last load so we can optimize next load...
        nRowsWithValues = 0;

        // we use a fixed number of row/cols so init here...
        setRowCount( MAXPROCESSES );
        setColumnCount( 5 );

        // init headers and decorations...
        {
            QStringList stringlist;
            setHorizontalHeaderLabels( stringlist << "PID" << "Environments" << "Connections" << "Statements" << "Descriptors" );
            setSelectionBehavior( QAbstractItemView::SelectRows );
            setSelectionMode( QAbstractItemView::SingleSelection );
            verticalHeader()->setVisible( false );
        }
        
        // preload table with item objects...
        for ( int nRow = 0; nRow < rowCount(); nRow++ )
        {
            for ( int nCol = 0; nCol < columnCount(); nCol++ )
            {
                setItem( nRow, nCol, new QTableWidgetItem( "" ) );
            }
        }
    }

    // init timer...
    {
        hStats = 0;
        pTimer = new QTimer( this );
        connect( pTimer, SIGNAL(timeout()), SLOT(slotLoad()) );
        pTimer->start( 2000 ); // 1000 = 1second
    }
}
コード例 #14
0
ファイル: qgspgtablemodel.cpp プロジェクト: alexbruy/QGIS
QgsPgTableModel::QgsPgTableModel()
{
  QStringList headerLabels;
  headerLabels << tr( "Schema" );
  headerLabels << tr( "Table" );
  headerLabels << tr( "Comment" );
  headerLabels << tr( "Column" );
  headerLabels << tr( "Data Type" );
  headerLabels << tr( "Spatial Type" );
  headerLabels << tr( "SRID" );
  headerLabels << tr( "Feature id" );
  headerLabels << tr( "Select at id" );
  headerLabels << tr( "Check PK unicity" );
  headerLabels << tr( "Sql" );
  setHorizontalHeaderLabels( headerLabels );
  setHeaderData( Columns::DbtmSelectAtId, Qt::Orientation::Horizontal, tr( "Disable 'Fast Access to Features at ID' capability to force keeping the attribute table in memory (e.g. in case of expensive views)." ), Qt::ToolTipRole );
  setHeaderData( Columns::DbtmCheckPkUnicity, Qt::Orientation::Horizontal, tr( "Enable check for primary key unicity when loading views and materialized views. This option can make loading of large datasets significantly slower." ), Qt::ToolTipRole );
}
コード例 #15
0
ファイル: ledger.cpp プロジェクト: cfbao/Accounting
Ledger::Ledger(QLineEdit *totalBox, QLineEdit *netBox, QLineEdit *debtBox, QLineEdit *loanBox) : QStandardItemModel()
{
    // variable initialization
    total = 0.0;
    debt = 0.0;
    loan = 0.0;
    net = total - debt + loan;
    // setup header
    QStringList header;
    header << "Date" << "Description" << "Amount" << "Category";
    setHorizontalHeaderLabels(header);
    // set display box
    this->totalBox = totalBox;
    this->netBox   = netBox;
    this->debtBox  = debtBox;
    this->loanBox  = loanBox;
    // setup undo framework
    undoStack = new QUndoStack(this);
}
コード例 #16
0
ファイル: PropertyTableWidget.cpp プロジェクト: Ilikia/naali
void PropertyTableWidget::InitWidget()
{
    // Set up drop functionality.
    setAcceptDrops(true);
    setDragEnabled(false);
    setDragDropMode(QAbstractItemView::DropOnly);
    setAcceptDrops(true);
    setDropIndicatorShown(true);
    setDragDropOverwriteMode(true);

    // Set up headers and size.
    setHorizontalHeaderLabels(QStringList() << tr("Name") << tr("Type") << tr("Value"));
    verticalHeader()->setVisible(false);
    resizeColumnToContents(0);
    horizontalHeader()->setStretchLastSection(true);
    horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    setMouseTracking(true);
}
コード例 #17
0
void LC_DlgSplinePoints::updatePoints()
{
    bool const useSpline = ui->rbSplinePoints->isChecked();

    auto const& bData = bezier->getData();
    auto const& pts = useSpline?bData.splinePoints:bData.controlPoints;
    auto model = new QStandardItemModel(pts.size(), 2, this);
    model->setHorizontalHeaderLabels({"x", "y"});

    //set spline data
    for (size_t row = 0; row < pts.size(); ++row) {
        auto const& vp = pts.at(row);
        QStandardItem* x = new QStandardItem(QString::number(vp.x));
        model->setItem(row, 0, x);
        QStandardItem* y = new QStandardItem(QString::number(vp.y));
        model->setItem(row, 1, y);
    }
    ui->tvPoints->setModel(model);
}
コード例 #18
0
ファイル: PointTableWidget.cpp プロジェクト: pengwg/vurtigo
PointTableWidget::PointTableWidget(QWidget * parent, const QPolygonF * const points, const Settings * const settings) : QTableWidget(parent) , points(*points) {
    if (settings == NULL)
        setDefaultSettings();
    else
        this->settings = *settings;

    setColumnCount(this->settings.colHeader.size());
    setHorizontalHeaderLabels(this->settings.colHeader);

    setColumnWidths();

    setSelectionMode(QAbstractItemView::ExtendedSelection);
    if (this->settings.autoSelectRow)
        setSelectionBehavior(QAbstractItemView::SelectRows);

    editingCell = QPoint(-1, -1);
    connect(this, SIGNAL(cellDoubleClicked(int,int)), this, SLOT(cellEditingSlot(int,int)));
    connect(this, SIGNAL(cellChanged(int,int)), this, SLOT(updateCell(int,int)));
}
コード例 #19
0
QuizWordsChooserTable::QuizWordsChooserTable(const WordsPtrSet &words, QWidget *parent) :
    QTableWidget(parent), m_Cards(words)
{
    setColumnCount(2);
    setRowCount(0);

    setHorizontalHeaderLabels(QStringList() << "" << tr("Word"));
    // Select whole row without multi-selection.
    setSelectionBehavior(QAbstractItemView::SelectRows);
    setSelectionMode(QAbstractItemView::SingleSelection);

    horizontalHeader()->setResizeMode(0, QHeaderView::Fixed);
    horizontalHeader()->setResizeMode(1, QHeaderView::Stretch);

    // No edit triggers
    setEditTriggers(QAbstractItemView::NoEditTriggers);

    fillTable();
}
コード例 #20
0
ファイル: barpackagemodel.cpp プロジェクト: dridk/QBarManager
void BarPackageModel::load(const QVariantList &datas)
{
clear();
setHorizontalHeaderLabels(QStringList()<<"application"<<"version");


foreach ( QVariant item, datas)
{


    QString rawName =item.toMap().value("name").toString();
    QString id =item.toMap().value("id").toString();
    QString version =item.toMap().value("version").toString();


    QStringList names = rawName.remove(id.replace("-",".")).split(".");




    QString name = names[names.length()-2];

    QStandardItem * nameItem = new QStandardItem(0);
    nameItem->setData(item);
    nameItem->setText(name);
    nameItem->setIcon(QIcon(":app.png"));
    if (rawName.contains("sys"))
    nameItem->setEnabled(false);

    QStandardItem * versionItem = new QStandardItem(1);
    versionItem->setText(version);

    QList<QStandardItem*> items;
    items.append(nameItem);
    items.append(versionItem);

    appendRow(items);




}
コード例 #21
0
void FileListModel::setPath( const QString &path )
{
    dir.setPath( path );
    if ( !dir.exists() )
    {
        QMessageBox::information( nullptr, tr( "info" ), tr( "Dir Not Exist!" ) );
        return;
    }
    fileInfoHash.clear();
    clear();
    QStringList columnLabels;
    columnLabels.push_back( tr( "Name" ) );
    columnLabels.push_back( tr( "Size" ) );
    columnLabels.push_back( tr( "Kind" ) );
    columnLabels.push_back( tr( "Date Modified" ) );
    setHorizontalHeaderLabels( columnLabels );
    QList<QFileInfo> fileList = dir.entryInfoList();
    int rowCount = 0;
    for ( const QFileInfo &entry : fileList )
    {
        QString fileName = entry.fileName();
        if ( fileName == "." )
        {
            continue;
        }
        QStandardItem *c1 = new QStandardItem( entry.fileName() );
        QStandardItem *c2 = new QStandardItem( QString::number( entry.size() ) );
        c2->setFlags(Qt::ItemIsSelectable);
        QStandardItem *c3 = new QStandardItem( entry.suffix() );
        c3->setFlags(Qt::ItemIsSelectable);
        QStandardItem *c4 = new QStandardItem( entry.lastModified().toString() );
        c4->setFlags(Qt::ItemIsSelectable);

        setItem( rowCount, 0, c1 );
        setItem( rowCount, 1, c2 );
        setItem( rowCount, 2, c3 );
        setItem( rowCount, 3, c4 );

        fileInfoHash.insert( rowCount, entry );
        ++rowCount;
    }
}
コード例 #22
0
ファイル: ledger.cpp プロジェクト: cfbao/Accounting
void Ledger::readFile(QTextStream *inputStream)
{
    if(inputStream){
        if( !(validFile = readCsv(inputStream)) ){
            clear();
            setHorizontalHeaderLabels(QStringList("Error"));
            appendRow(static_cast<QStandardItem*>(new LedgerItem::QStandardItem("Invalid File Format")));
        }
        computeTotal();
    } else{
        appendRow(constructEmptyRow());
        validFile = true;
    }
    undoStack->setClean();
    // setup signals
    connect(this,&QAbstractItemModel::dataChanged, this,&Ledger::computeTotal);
    connect(this,&QAbstractItemModel::rowsRemoved, this,&Ledger::computeTotal);
    connect(this,&QAbstractItemModel::rowsInserted,this,&Ledger::computeTotal);
    connect(undoStack,&QUndoStack::cleanChanged, this,&Ledger::sendChangeSignal);
}
コード例 #23
0
AdvancedSettings::AdvancedSettings(QWidget *parent)
    : QTableWidget(parent)
{
    // column
    setColumnCount(COL_COUNT);
    QStringList header = { tr("Setting"), tr("Value", "Value set for this setting") };
    setHorizontalHeaderLabels(header);
    // row
    setRowCount(ROW_COUNT);
    verticalHeader()->setVisible(false);
    // etc.
    setAlternatingRowColors(true);
    setEditTriggers(QAbstractItemView::NoEditTriggers);
    // Signals
    connect(&spin_cache, SIGNAL(valueChanged(int)), SLOT(updateCacheSpinSuffix(int)));
    // Load settings
    loadAdvancedSettings();
    resizeColumnToContents(0);
    horizontalHeader()->setStretchLastSection(true);
}
コード例 #24
0
ファイル: TableView.cpp プロジェクト: pepsi7959/OpenStudio
  TableView::TableView( QWidget* parent):QTableWidget(0,6,parent)
  {
    setSortingEnabled(true);
    setContextMenuPolicy(Qt::CustomContextMenu);
    horizontalHeader()->setSortIndicator(0,Qt::AscendingOrder);
    horizontalHeader()->setSortIndicatorShown(true);
    horizontalHeader()->setSectionsClickable(true);
    horizontalHeader()->setSectionsMovable(true);
    setSelectionBehavior(QAbstractItemView::SelectRows);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    m_slHeaders  << tr("Variable Name") << tr("Key Value") << tr("Reporting Frequency") << tr("Alias") << tr("Environment Period") << tr("File");
    setHorizontalHeaderLabels( m_slHeaders );
    horizontalHeader()->setStretchLastSection(true);

    verticalHeader()->hide();
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    setEditTriggers(QAbstractItemView::NoEditTriggers); // no editing
    setDragEnabled(true);

  }
コード例 #25
0
ファイル: Queue.cpp プロジェクト: dtamayo/OGRE
Queue::Queue(int rows, int columns, QWidget* parent) : QTableWidget(rows, columns, parent) {
    setColumnWidth(0, 210);
    QHeaderView* h = horizontalHeader();
    h->setResizeMode(QHeaderView::Stretch);
    setContextMenuPolicy(Qt::CustomContextMenu);
    QStringList headers;
    headers << "Action" << "Span" << "X Rotation" << "Y Rotation" << "Z Rotation"
            << "Zoom Factor" << "Frame Number";
    setHorizontalHeaderLabels(headers);
    Action act;
    act.typ = INITIALIZE;
    act.xrot = 0;
    act.yrot = 0;
    act.zrot = 0;
    act.scale = 1;
    act.frame = 0;
    act.span = 0;
    act.queueIndex = 0;
    addActionToQueue(act);
}
コード例 #26
0
ファイル: Table.cpp プロジェクト: egor-dolzhenko/STAGR
Table::Table(QWidget* parent, QStringList header, QVector< QMap<QString, QString> > *entries)
{
    setRowCount(entries->size());
    setColumnCount(header.size());
    setAlternatingRowColors(true);
    setHorizontalHeaderLabels(header);
    setEditTriggers(QAbstractItemView::NoEditTriggers);
    setSelectionBehavior(QAbstractItemView::SelectRows);
    horizontalHeader()->setHighlightSections(false);

    for(int rowIndex = 0; rowIndex < entries->size(); rowIndex++)
    {
        for(int columnIndex = 0; columnIndex < header.size(); columnIndex++)
        {
            QTableWidgetItem *item = new QTableWidgetItem;
            item->setText(entries->at(rowIndex)[header[columnIndex]]);
            setItem(rowIndex, columnIndex, item);
        }
    }
}
コード例 #27
0
void BedItemModel::reload() {
    _currentBed = 0;
    clear();

    QStringList hh;
    hh << tr("Beds");
    setHorizontalHeaderLabels(hh);

    if (!_profile) {
        return;
    }

    int bedCnt = _profile->getBedCount();

    for (int pos = 0; pos < bedCnt; pos++) {
        appendItem(_profile->getBedByPosition(pos));
    }

    emit reloaded();
    reset();
}
コード例 #28
0
//#include "focustable.h"
ColumnarTableWidget::ColumnarTableWidget(const QStringList & headers,QWidget * parent) : QTableWidget(parent) {
  m_settings = 0;
  m_saveConfig = true;
  m_columnHeadings = headers;
  m_defaultWidthKey = "Default width";
  m_columnWidthsKey = "Column widths";
  m_stateKey = "Column state";
  m_defaultWidth = -1;
  m_markColumn = -1;
  setRowCount(0);
  setColumnCount(m_columnHeadings.size());
  setSelectionBehavior(QAbstractItemView::SelectRows);
  setHorizontalHeaderLabels(m_columnHeadings);
  horizontalHeader()->setStretchLastSection(true);
  horizontalHeader()->setSectionsMovable(true);
  horizontalHeader()->setSectionsClickable(true);
  verticalHeader()->setVisible(false);
  verticalHeader()->sectionResizeMode(QHeaderView::Fixed);
  //verticalHeader()->setDefaultSectionSize(44);
  connect(this->horizontalHeader(),SIGNAL(sectionDoubleClicked(int)),this,SLOT(onColumnDialog(int)));
}
コード例 #29
0
void DischargeItemTable::setVariable(const Quantity * s)
{
    if (_variable != s) {
        _variable = s;
        QStringList headers;
        headers << tr("Radionuclides") << s->displayTextWithUnit();
        setHorizontalHeaderLabels(headers);

        //modify resize mode
        QHeaderView * header = this->horizontalHeader();
        if (header != 0) {
#if QT_VERSION >= 0x050000
            header->setSectionResizeMode(0, QHeaderView::Interactive);
            header->setSectionResizeMode(1, QHeaderView::ResizeToContents);
#else
            header->setResizeMode(0, QHeaderView::Interactive);
            header->setResizeMode(1, QHeaderView::ResizeToContents);
#endif
        }
    }
}
コード例 #30
0
ファイル: Table.cpp プロジェクト: egor-dolzhenko/STAGR
Table::Table(QWidget* parent, QStringList header,
             QStringList* entries, int numberOfEntries)
    :QTableWidget(parent)
{
    setRowCount(numberOfEntries);
    setColumnCount(header.size());
    setAlternatingRowColors(true);
    setHorizontalHeaderLabels(header);
    setEditTriggers(QAbstractItemView::NoEditTriggers);
    setSelectionBehavior(QAbstractItemView::SelectRows);
    horizontalHeader()->setHighlightSections(false);
    for(int rowIndex = 0; rowIndex < numberOfEntries; rowIndex++)
    {
        for(int columnIndex = 0; columnIndex < entries[rowIndex].size(); columnIndex++)
        {
            QTableWidgetItem *item = new QTableWidgetItem;
            item->setText(entries[rowIndex][columnIndex]);
            setItem(rowIndex, columnIndex, item);
        }
    }
}