コード例 #1
0
void KVocTrainTable::setFont(const QFont & font)
{
  QTable::setFont(font);
  horizontalHeader()->setFont(KGlobalSettings::generalFont());
  for (unsigned i = 0; i < (unsigned) numRows(); ++i)
    setRowHeight(i, fontMetrics().lineSpacing());
}
//------------------------------+
//  DispWindow constructor      |
//------------------------------+
DispWindow::DispWindow( IWindow* dw) :
             IMultiCellCanvas( idwin,dw,dw)
{
  IPresSpaceHandle   hps;

  hps = IPresSpaceHandle();
  ICommandHandler::handleEventsFor( this );
  IMouseClickHandler::handleEventsFor( this );

  setColor(IColor(IColor::cyan));


  output = new IStaticText(DSP_ID,this,this);
  output->setText("OPENDOC+ICLUI");

  IFont tempFont;                       
  tempFont.setOutline(true);
  tempFont.setPointSize(15);
  tempFont.setName("Helv");
  output->setFont(tempFont);            
  output->setAlignment(IStaticText::centerRight);
  addToCell(output,1,1);
  setRowHeight(1,5,true);
  setColumnWidth(1,10,true);

  output->setAutoDeleteObject();
  setAutoDeleteObject();
}
コード例 #3
0
void MusicSongsListWidget::selectRow(int index)
{
    if(index < 0)
    {
        return;
    }
    QTableWidget::selectRow(index);

    replacePlayWidgetRow();
    delete takeItem(index, 0);
    delete takeItem(index, 1);
    delete takeItem(index, 2);
    setItem(index, 0, new QTableWidgetItem);
    setItem(index, 1, new QTableWidgetItem);
    setItem(index, 2, new QTableWidgetItem);

    QString name = !m_musicSongs->isEmpty() ? m_musicSongs->at(index).getMusicName() : QString();
    QString path = !m_musicSongs->isEmpty() ? m_musicSongs->at(index).getMusicPath() : QString();

    m_musicSongsPlayWidget = new MusicSongsListPlayWidget(index, this);
    m_musicSongsPlayWidget->setParameter(name, path);
    QWidget *widget, *widget1;
    m_musicSongsPlayWidget->getWidget(widget, widget1);

    setCellWidget(index, 0, widget);
    setCellWidget(index, 1, m_musicSongsPlayWidget);
    setCellWidget(index, 2, widget1);
    setRowHeight(index, 60);
    m_playRowIndex = index;
}
コード例 #4
0
void QKeyValueListView::listUpdate_slot(void)
{
    int                 i, n;
    ListMap::iterator   it;

    QColor              clCL1, clCL2;
    QColor              clB1, clB2;

    int                 fontSize = 8;
    int                 rowHeight = 20;

    clCL1 = QColor(0x00, 0x00, 0xFF);
    clCL2 = QColor(0x00, 0x00, 0x00);
    clB1  = QColor(0xFF, 0xFF, 0xFF);
    clB2  = QColor(0xE0, 0xE0, 0xE0);

    m_mutex->lock();

    n = m_data.size();
    setRowCount(n);
    setColumnCount(2);

    for(i=0, it=m_data.begin(); it!=m_data.end(); i++, it++) {
        // set name cell
        if( this->item(i, 0) != NULL ) {
            this->item(i, 0)->setText(it.key());
        } else {
            QTableWidgetItem* item = new QTableWidgetItem();
            item->setText(it.key());

            item->setTextColor(clCL1);
            if( i % 2 == 0 ) item->setBackgroundColor(clB1);
            else             item->setBackgroundColor(clB2);

            item->setFont(QFont("", fontSize));

            this->setItem(i, 0, item);
        }

        // set value cell
        if( this->item(i, 1) != NULL ) {
            this->item(i, 1)->setText(it.value());
        } else {
            QTableWidgetItem* item = new QTableWidgetItem();
            item->setText(it.value());

            item->setTextColor(clCL2);
            if( i % 2 == 0 ) item->setBackgroundColor(clB1);
            else             item->setBackgroundColor(clB2);

            item->setFont(QFont("", fontSize));

            this->setItem(i, 1, item);
        }

        setRowHeight(i, rowHeight);
    }

    m_mutex->unlock();
}
コード例 #5
0
void SymbolListWidget::SetFavoritePage(QList<int> flist)
{
clearContents();
int rows=(flist.count()-1)/4+1;
setRowCount(rows);
for ( uint j = 0; j < rows; ++j ) setRowHeight(j,36);
QString icon_name;
for( int i = 0; i < flist.count(); i++ )
	{
	if ((flist.at(i)>-1) && (flist.at(i)<412))
		{
		QTableWidgetItem* item= new QTableWidgetItem();
		if (flist.at(i)>=372)
			{
			icon_name=":/symbols/img"+QString::number(flist.at(i)-371)+"greek.png";
			}
		else
			{
			icon_name=":/symbols/img"+QString::number(flist.at(i)+1)+".png";
			}
		item->setText(code[flist.at(i)]+";"+QString::number(flist.at(i)));
		item->setIcon(QIcon(icon_name));
		item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
		setItem(i/4,i%4,item);
		}
	}
}
コード例 #6
0
ファイル: juce_ListBox.cpp プロジェクト: Emisense/S3Test
void ListBox::refreshFromValueTree (const ValueTree& state, ComponentBuilder&)
{
    ComponentBuilder::refreshBasicComponentProperties (*this, state);

    setRowHeight (state.getProperty (Ids::rowHeight, defaultListRowHeight));
    setOutlineThickness (state.getProperty (Ids::borderThickness, 0));
}
コード例 #7
0
/** Change the style of the current track. Moreover, this function is reused when the user is changing fonts in the settings. */
void Playlist::highlightCurrentTrack()
{
	QTableWidgetItem *it;
	const QFont font = Settings::getInstance()->font(Settings::PLAYLIST);
	if (rowCount() > 0) {
		for (int i=0; i < rowCount(); i++) {
			for (int j = 0; j < columnCount(); j++) {
				it = item(i, j);
				QFont itemFont = font;
				itemFont.setBold(false);
				itemFont.setItalic(false);
				it->setFont(itemFont);
				QFontMetrics fm(itemFont);
				setRowHeight(i, fm.height());
			}
		}
		for (int j=0; j < columnCount(); j++) {
			it = item(track, j);
			// If there is actually one selected track in the playlist
			if (it != NULL) {
				QFont itemFont = font;
				itemFont.setBold(true);
				itemFont.setItalic(true);
				it->setFont(itemFont);
			}
		}
	}
}
コード例 #8
0
void MusicSongsListWidget::replacePlayWidgetRow()
{
    if(m_playRowIndex >= rowCount() || m_playRowIndex < 0)
    {
        m_playRowIndex = 0;
    }
    QString name = !m_musicSongs->isEmpty() ? m_musicSongs->at(m_playRowIndex).getMusicName() : QString();

    setRowHeight(m_playRowIndex, 30);
    removeCellWidget(m_playRowIndex, 0);
    removeCellWidget(m_playRowIndex, 1);
    removeCellWidget(m_playRowIndex, 2);

    delete takeItem(m_playRowIndex, 0);
    delete takeItem(m_playRowIndex, 1);
    delete takeItem(m_playRowIndex, 2);
    QTableWidgetItem *item = new QTableWidgetItem;
    setItem(m_playRowIndex, 0, item);
    item = new QTableWidgetItem(QFontMetrics(font()).elidedText(name, Qt::ElideRight, 242));
    item->setTextColor(QColor(50, 50, 50));
    item->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter);
    setItem(m_playRowIndex, 1, item);
    item = new QTableWidgetItem( (*m_musicSongs)[m_playRowIndex].getMusicTime() );
    item->setTextColor(QColor(50, 50, 50));
    item->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter);
    setItem(m_playRowIndex, 2, item);
    delete m_musicSongsPlayWidget;
    m_musicSongsPlayWidget = nullptr;
}
コード例 #9
0
ファイル: Queue.cpp プロジェクト: dtamayo/OGRE
/*! @brief Takes in an action and adds it to the queue.

    This function parses the passed action and displays the appropriate information in the table.
    It also stores the action as data in the QTableWidgetItem in the first column.
    This is done using the function setData().
    This function takes in an int and a QVariant.
    The int represents a role - this is basically an index into an array or a key into a hashtable.
    The role used here is predefined within Qt - Qt::UserRole.
    This role is specifically set aside by Qt for the user to use - it should be empty unless the user puts something in it.
    The QVariant is the data to be stored. QVariants can store any type of data - even structs!
    In this case, an action struct is being stored using the function setValue().
    After storing the action into the QVariant, the QVariant can be stored in the QTableWidgetItem using setData().

    To extract the data from the QTableWidgetItem, simply call the function data().
    This function takes in an int representing a role. To retrieve the data store here, pass it Qt::UserRole.
    The function will return a QVariant. The QVariant can be cast into whatever data type is stored within it using the value() function.
    In this case, of course, the data type is the struct Action. The form for the function should look like this:

    Action act = qvariant.value<Action>();

    "Action" here can be replaced with an arbitrary data type.
*/
void Queue::addActionToQueue(Action action) {
    QVariant v;
    v.setValue(action);
    QTableWidgetItem* act = new QTableWidgetItem(0);
    act->setData(Qt::UserRole, v);
    act->setFlags(act->flags() ^ Qt::ItemIsEditable);

    QTableWidgetItem* span = new QTableWidgetItem(0);
    span->setFlags(span->flags() ^ Qt::ItemIsEditable);
    span->setTextAlignment(Qt::AlignHCenter);

    int index = action.queueIndex;
    if (action.typ != INITIALIZE || rowCount() == 0) {
        insertRow(index);
        setRowHeight(index, 20);
    }

    setItem(index, 0, act);
    setItem(index, 1, span);
    for (int i=0; i < 5; i++) {
        QTableWidgetItem* item = new QTableWidgetItem(0);
        item->setFlags(item->flags() ^ Qt::ItemIsEditable);
        item->setTextAlignment(Qt::AlignHCenter);
        setItem(index, i + 2, item);
    }
    updateQueue(index, rowCount());
}
コード例 #10
0
ファイル: ScreenSetupView.cpp プロジェクト: 335/synergy
void ScreenSetupView::setTableSize()
{
	for (int i = 0; i < model()->columnCount(); i++)
		setColumnWidth(i, width() / model()->columnCount());

	for (int i = 0; i < model()->rowCount(); i++)
		setRowHeight(i, height() / model()->rowCount());
}
コード例 #11
0
ファイル: marklist.cpp プロジェクト: serghei/kde3-kdegraphics
void MarkList::insertItem( const QString& text, int index, const QString& tip)
{
    MarkListItem *_item;
    _item = new MarkListItem( this, text, tip, viewport()->paletteBackgroundColor(), _miniWidget, index );
    setNumRows( index + 1 );
    setCellWidget( index, 0, _item );
    setRowHeight( index, _item->height() );
}
コード例 #12
0
//==============================================================================
FileListComponent::FileListComponent (DirectoryContentsList& listToShow)
    : ListBox (String::empty, 0),
      DirectoryContentsDisplayComponent (listToShow)
{
    setModel (this);
    setRowHeight (getLookAndFeel().getFileListComponentRowHeight());
    fileList.addChangeListener (this);
}
 //==============================================================================
 AndroidBluetoothMidiDevicesListBox()
     : timerPeriodInMs (1000)
 {
     setRowHeight (40);
     setModel (this);
     setOutlineThickness (1);
     updateDeviceList();
     startTimer (timerPeriodInMs);
 }
コード例 #14
0
void TracksView::updateFrozenSectionHeight(int logicalIndex, int /*oldSize*/, int newSize)
      {
      if (logicalIndex < _frozenRowCount) {
            setRowHeight(logicalIndex, newSize);
            _frozenCornerTableView->setRowHeight(logicalIndex, newSize);
            _frozenVTableView->setRowHeight(logicalIndex, newSize);
            updateFrozenTableGeometry();
            }
      }
コード例 #15
0
ファイル: ConstraintDialog.cpp プロジェクト: harmegnies/douml
ConstraintTable::ConstraintTable(QWidget * parent, ConstraintCanvas * c)
    : Q3Table(c->elements.count(), 4, parent)
{
    setSorting(true);
    setSelectionMode(NoSelection);
    setRowMovingEnabled(FALSE);

    horizontalHeader()->setLabel(0, TR("visible"));
    horizontalHeader()->setLabel(1, " ");
    horizontalHeader()->setLabel(2, TR("element"));
    horizontalHeader()->setLabel(3, TR("constraint"));
    setColumnStretchable(0, FALSE);
    setColumnStretchable(1, FALSE);

    int row;
    bool v = c->indicate_visible;
    Q3ValueList<BrowserNode *> & hv = c->hidden_visible;
    BrowserNodeList & elts = c->elements;
    BrowserNode * bn;
    QString yes = TR("  yes");
    QString empty;

    elts.sort();

    for (bn = elts.first(), row = 0; bn != 0; bn = elts.next(), row += 1) {
        if ((v) ? hv.findIndex(bn) != -1 : hv.findIndex(bn) == -1)
            setText(row, 0, yes);

        setPixmap(row, 1, *(bn->pixmap(0)));

        TableItem * ti;

        ti = new TableItem(this, Q3TableItem::Never, bn->full_name(TRUE));
        ti->setReplaceable(FALSE);
        setItem(row, 2, ti);

        QString s = toUnicode(bn->constraint());
        int n = s.count('\n');

        ti = new TableItem(this, Q3TableItem::Never, s);
        ti->setReplaceable(FALSE);
        setItem(row, 3, ti);

        if (n != 0) {
            // note : adjustRow(row) does nothing
            setRowHeight(row, rowHeight(row) * (n + 1));
        }
    }

    adjustColumn(0);
    adjustColumn(1);
    setColumnStretchable(2, TRUE);
    setColumnStretchable(3, TRUE);

    connect(this, SIGNAL(pressed(int, int, int, const QPoint &)),
            this, SLOT(button_pressed(int, int, int, const QPoint &)));
}
コード例 #16
0
ファイル: kwqtableview.cpp プロジェクト: KDE/kwordquiz
void KWQTableView::adjustRow(int row)
{
  // we want to make the row high enough to display content, but
  // if the user already made it even higher we keep that height
  //int r = currentIndex().row();
  int rh = rowHeight(row);
  resizeRowToContents(row);
  if (rh > rowHeight(row))
    setRowHeight(row, rh);
}
コード例 #17
0
void MainTableView::setSize(int size)
{
    for( int i = 0; i < MAX_ROWS; ++ i )
    {
        setRowHeight(i, size);
        setColumnWidth(i, size);
        QSize iconSize(size, size);
        setIconSize(iconSize);
    }
}
コード例 #18
0
ConstraintTable::ConstraintTable(QWidget * parent, ConstraintCanvas * c)
    : QTableWidget(c->elements.count(), 4, parent)
{
    setSelectionMode(NoSelection);
    //setSortingEnabled(true);
    verticalHeader()->setSectionsMovable(false);
    QStringList headerLabels;
    headerLabels<<tr("visible")
               <<" "
              <<tr("element")
             <<tr("constraint");
    /*
    horizontalHeader()->setLabel(0, TR("visible"));
    horizontalHeader()->setLabel(1, " ");
    horizontalHeader()->setLabel(2, TR("element"));
    horizontalHeader()->setLabel(3, TR("constraint"));
    */
    setHorizontalHeaderLabels(headerLabels);
    horizontalHeader()->setSectionResizeMode(0, QHeaderView::Interactive);
    horizontalHeader()->setSectionResizeMode(1, QHeaderView::Interactive);
    bool v = c->indicate_visible;
    QList<BrowserNode *> & hv = c->hidden_visible;
    BrowserNodeList & elts = c->elements;
    QString yes = tr("  yes");

    elts.sort();

    int row = 0;
    foreach (BrowserNode *bn, elts) {
        setItem(row, 0, new QTableWidgetItem());
        setItem(row, 1, new QTableWidgetItem());
        if ((v) ? hv.indexOf(bn) != -1 : hv.indexOf(bn) == -1)
            item( row, 0)->setText( yes);

        item(row, 1)->setIcon( *(bn->pixmap(0)));

        TableItem * ti;

        ti = new TableItem(TableItem::Never, bn->full_name(TRUE), TableItem::TableItemType);
        setItem(row, 2, ti);

        QString s = toUnicode(bn->constraint());
        int n = s.count('\n');

        ti = new TableItem(TableItem::Never, s, TableItem::TableItemType);
        setItem(row, 3, ti);

        if (n != 0) {
            // note : adjustRow(row) does nothing
            setRowHeight(row, rowHeight(row) * (n + 1));
        }
        ++row;
    }
コード例 #19
0
ファイル: sensorsList.cpp プロジェクト: Ashatta/tools
void SensorsList::configurePorts(QStringList const &ports)
{
	setRowCount(ports.length());
	for (int row = 0; row < ports.length(); ++row) {
		setRowHeight(row, 20);
		mPortRowMap[ports.at(row)] = row;

		setItem(row, 0, new QTableWidgetItem(ports.at(row)));
		setItem(row, 1, new QTableWidgetItem(tr("N/A")));
		setItem(row, 2, new QTableWidgetItem(tr("N/A")));
	}
}
コード例 #20
0
void ColorListWidget::append_widget(int col)
{
    ColorSelector* cbs = new ColorSelector;
    cbs->setDisplayMode(ColorPreview::AllAlpha);
    cbs->setColor(p->colors[col]);
    //connect(cbs,SIGNAL(colorChanged(QColor)),SLOT(emit_changed()));
    p->mapper.setMapping(cbs,col);
    connect(cbs,SIGNAL(colorChanged(QColor)),&p->mapper,SLOT(map()));
    connect(this,SIGNAL(wheelFlagsChanged(ColorWheel::Display_Flags)),
            cbs,SLOT(setWheelFlags(ColorWheel::Display_Flags)));
    appendWidget(cbs);
    setRowHeight(count()-1,22);
}
コード例 #21
0
void MusicSongsListWidget::clearAllItems()
{
    //Remove play widget
    setRowHeight(m_playRowIndex, 30);
    removeCellWidget(m_playRowIndex, 0);
    removeCellWidget(m_playRowIndex, 1);
    removeCellWidget(m_playRowIndex, 2);
    delete m_musicSongsPlayWidget;
    m_musicSongsPlayWidget = nullptr;
    m_playRowIndex = 0;
    //Remove all the original item
    MusicAbstractTableWidget::clear();
    setColumnCount(3);
}
コード例 #22
0
ファイル: chartableview.cpp プロジェクト: luzpaz/scribus
void CharTableView::resizeEvent(QResizeEvent *e)
{
	QTableView::resizeEvent(e);
	if (model())
	{
		model()->setViewWidth(e->size().width());
		// The resizeColumnsToContents() method won't work here.
		// It doesn't handle cells without any content. And it creates
		// larger columns than required. Dunno why.
		for (int i = 0; i < model()->columnCount(); ++i)
			setColumnWidth(i, e->size().width() / model()->columnCount());
		for (int i = 0; i < model()->rowCount(); ++i)
			setRowHeight(i, e->size().width() / model()->columnCount() + 5);
	}
}
コード例 #23
0
void MusicDownloadTableWidget::createItem(int bitrate, const QString &type, const QString &info, const QString &icon)
{
    int index = rowCount();
    setRowCount(index + 1);
    setRowHeight(index, ROW_HEIGHT);
    QTableWidgetItem *it = new QTableWidgetItem;
    it->setData(BITRATE_ROLE, bitrate);
    setItem(index, 0,  it);

    MusicDownloadTableItem *item = new MusicDownloadTableItem(this);
    item->setIcon(icon);
    item->setInfomation(info);
    item->setText(type);
    m_items << item;

    setCellWidget(index, 0, item);
}
コード例 #24
0
int KWidgetListbox::insertItem(QWidget* item, int index)
{
  int row;

  if(index == -1)
  {
    row = numRows();
    setNumRows(row + 1);
  }
  else
    return -1;

  setRowHeight(row, item->height());
  setCellWidget(row, 0, item);
  setItemColors(row, even(row));
  return row;
}
コード例 #25
0
void MusicDownloadTableWidget::createItem(const MusicObject::MusicSongAttribute &attr, const QString &type, const QString &icon)
{
    int index = rowCount();
    setRowCount(index + 1);
    setRowHeight(index, ROW_HEIGHT);
    QTableWidgetItem *it = new QTableWidgetItem;
    MusicDownloadTableItemRole role(attr.m_bitrate, attr.m_format, attr.m_size);
    it->setData(TABLE_ITEM_ROLE, QVariant::fromValue<MusicDownloadTableItemRole>(role));
    setItem(index, 0,  it);

    MusicDownloadTableItem *item = new MusicDownloadTableItem(this);
    item->setIcon(icon);
    item->setInformation(QString("%1/%2KBPS/%3").arg(attr.m_size).arg(attr.m_bitrate).arg(attr.m_format.toUpper()));
    item->setText(type);
    m_items << item;

    setCellWidget(index, 0, item);
}
コード例 #26
0
void KoTableRowStyle::loadOdfProperties(KoStyleStack &styleStack)
{
    // The fo:background-color attribute specifies the background color of a cell.
    if (styleStack.hasProperty(KoXmlNS::fo, "background-color")) {
        const QString bgcolor = styleStack.property(KoXmlNS::fo, "background-color");
        QBrush brush = background();
        if (bgcolor == "transparent")
           setBackground(Qt::NoBrush);
        else {
            if (brush.style() == Qt::NoBrush)
                brush.setStyle(Qt::SolidPattern);
            brush.setColor(bgcolor); // #rrggbb format
            setBackground(brush);
        }
    }

    // minimum row height
    if (styleStack.hasProperty(KoXmlNS::style, "min-row-height")) {
        setMinimumRowHeight(KoUnit::parseValue(styleStack.property(KoXmlNS::style, "min-row-height")));
    }

    // optimal row height
    if (styleStack.hasProperty(KoXmlNS::style, "use-optimal-row-height")) {
        setUseOptimalHeight(styleStack.property(KoXmlNS::style, "use-optimal-row-height") == "true");
    }

    // row height
    if (styleStack.hasProperty(KoXmlNS::style, "row-height")) {
        setRowHeight(KoUnit::parseValue(styleStack.property(KoXmlNS::style, "row-height")));
    }

    // The fo:keep-together specifies if a row is allowed to break in the middle of the row.
    if (styleStack.hasProperty(KoXmlNS::fo, "keep-together")) {
        setKeepTogether(styleStack.property(KoXmlNS::fo, "keep-together") != "auto");
    }

    // The fo:break-before and fo:break-after attributes insert a page or column break before or after a column.
    if (styleStack.hasProperty(KoXmlNS::fo, "break-before")) {
        setBreakBefore(KoText::textBreakFromString(styleStack.property(KoXmlNS::fo, "break-before")));
    }
    if (styleStack.hasProperty(KoXmlNS::fo, "break-after")) {
        setBreakAfter(KoText::textBreakFromString(styleStack.property(KoXmlNS::fo, "break-after")));
    }
}
コード例 #27
0
ファイル: CommentsWidget.cpp プロジェクト: starius/facts
 CommentsView(CommentsModel* model, Wt::WContainerWidget* p=0):
     Wt::WTableView(p) {
     setModel(model);
     setSortingEnabled(false);
     resize(770, 450);
     if (model->deleted_column != -1) {
         setColumnWidth(model->deleted_column, 20);
     }
     setColumnWidth(model->index_column, 40);
     setColumnWidth(model->text_column, model->deleted_column != -1 ? 660 : 700);
     setHeaderHeight(0);
     setRowHeight(ROW_HEIGHT);
     if (model->deleted_column != -1) {
         setColumnAlignment(model->deleted_column, Wt::AlignRight | Wt::AlignTop);
     }
     setColumnAlignment(model->index_column, Wt::AlignRight | Wt::AlignTop);
     setColumnAlignment(model->text_column, Wt::AlignLeft | Wt::AlignTop);
     addStyleClass("facts-commentsview");
 }
コード例 #28
0
/** Add a track to this Playlist instance. */
void Playlist::append(const MediaSource &m)
{
	// Resolve metaDatas from TagLib
	TagLib::FileRef f(m.fileName().toLocal8Bit().data());
	if (!f.isNull()) {
		sources.append(m);
		QString title(f.tag()->title().toCString());
		if (title.isEmpty()) {
			// Filename in a MediaSource doesn't handle cross-platform QDir::separator(), so '/' is hardcoded
			title = m.fileName().split('/').last();
		}

		// Then, construct a new row with correct informations
		QList<QTableWidgetItem *> widgetItems;
		QTableWidgetItem *trackItem = new QTableWidgetItem(QString::number(f.tag()->track()));
		QTableWidgetItem *titleItem = new QTableWidgetItem(title);
		QTableWidgetItem *albumItem = new QTableWidgetItem(f.tag()->album().toCString());
		QTableWidgetItem *lengthItem = new QTableWidgetItem(this->convertTrackLength(f.audioProperties()->length()));
		QTableWidgetItem *artistItem = new QTableWidgetItem(f.tag()->artist().toCString());
		QTableWidgetItem *ratingItem = new QTableWidgetItem("***");
		QTableWidgetItem *yearItem = new QTableWidgetItem(QString::number(f.tag()->year()));

		widgetItems << trackItem << titleItem << albumItem << lengthItem << artistItem << ratingItem << yearItem;

		int currentRow = rowCount();
		insertRow(currentRow);

		QFont font = Settings::getInstance()->font(Settings::PLAYLIST);
		for (int i=0; i < widgetItems.length(); i++) {
			QTableWidgetItem *item = widgetItems.at(i);
			item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
			item->setFont(font);
			setItem(currentRow, i, item);
			QFontMetrics fm(font);
			setRowHeight(currentRow, fm.height());
		}

		trackItem->setTextAlignment(Qt::AlignCenter);
		lengthItem->setTextAlignment(Qt::AlignCenter);
		ratingItem->setTextAlignment(Qt::AlignCenter);
		yearItem->setTextAlignment(Qt::AlignCenter);
	}
}
コード例 #29
0
ファイル: hexview.cpp プロジェクト: hempnall/QHexTools
HexView::HexView()
    : showGuidelines_(false),model_(0)
{

    setBytesPerRow( 16 );
    setRowHeight( 20 );
  //  setContentLength(0);
    setShowAscii(true);
    setShowHex(true);
    setShowOffsets(true);
    setOffsetsWidth(100);
    setSpacer(35);
    setHexSpacer(25);
    setAsciiSpacer(15);
    setOffsetLen(6);
     setContentLength(273);
    recalcHeight();
    recalcWidth();
    setRenderTarget(QQuickPaintedItem::FramebufferObject);
}
コード例 #30
0
void cCustomTitleModelTable::PrepareTable(cModelList *Table) {
    if (InModifTable) return;
    InModifTable=true;
    CustomTitleModelTableLockPaint.lock();
    this->setUpdatesEnabled(false);
    ModelTable=Table;
    int CurIndex=0;
    int NbrItem =ModelTable->List.count();
    int NbrCol  =this->viewport()->width()/ModelTable->ThumbnailSize.width();   if (NbrCol==0) NbrCol=1;
    int NbrRow  =NbrItem/NbrCol;
    if (NbrRow*NbrCol<NbrItem) NbrRow++;
    setColumnCount(NbrCol);
    setRowCount(NbrRow);
    setCurrentCell(CurIndex/NbrCol,CurIndex-(CurIndex/NbrCol)*NbrCol);
    for (int i=0;i<columnCount();i++)  setColumnWidth(i,ModelTable->ThumbnailSize.width()+20);
    for (int i=0;i<rowCount();i++)     setRowHeight(i,ModelTable->ThumbnailSize.height()+20);
    this->setUpdatesEnabled(true);
    InModifTable=false;
    CustomTitleModelTableLockPaint.unlock();
}