//================================================================================
//================================================================================
//================================================================================
LoggingTableWidget::LoggingTableWidget( int rows, int columns, QWidget * parent )
	: QTableWidget(rows,columns,parent),
	m_RowsAdded(false)
{
	m_TimerScrollToBottom = new QTimer;
	m_TimerScrollToBottom->setInterval(100);
	connect(m_TimerScrollToBottom,SIGNAL(timeout()),SLOT(ScrollToBottom()));
	m_TimerScrollToBottom->start();
	
	setRowCount(0);
	setColumnCount(4);

	verticalHeader()->setSectionResizeMode(QHeaderView::Fixed);
	verticalHeader()->setDefaultSectionSize(20);

	//	verticalHeader->setVisible(false);
	setSelectionBehavior(QAbstractItemView::SelectRows);

	horizontalHeader()->setStretchLastSection(true);

	QTableWidgetItem *time = new QTableWidgetItem("Time");
	time->setBackground(Qt::lightGray);
	setHorizontalHeaderItem( 0, time );

	QTableWidgetItem *logLevel = new QTableWidgetItem("Log level");
	logLevel->setBackground(Qt::lightGray);
	setHorizontalHeaderItem( 1, logLevel );

	QTableWidgetItem *category = new QTableWidgetItem("Category");
	category->setBackground(Qt::lightGray);
	setHorizontalHeaderItem( 2, category );

	QTableWidgetItem *message = new QTableWidgetItem("Message");
	message->setBackground(Qt::lightGray);
	setHorizontalHeaderItem( 3, message );

	horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
}
Exemplo n.º 2
0
//-----------------------------------------------------------------------------
// Function: CellEditTableView()
//-----------------------------------------------------------------------------
CellEditTableView::CellEditTableView(QWidget *parent):
QTableView(parent),
    copyAction_(tr("Copy"), this),
    pasteAction_(tr("Paste"), this),
    clearAction_(tr("Clear"), this)
{

    // cells are resized to match contents 
    horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);

    //last column is stretched take the available space in the widget
    horizontalHeader()->setStretchLastSection(true);

    // vertical headers are not visible
    verticalHeader()->hide();

    // set the height of a row to be smaller than default
    verticalHeader()->setDefaultSectionSize(fontMetrics().height() + 8);

    // easies to see the different rows from one another
    //setAlternatingRowColors(true);

    // words are wrapped in the cells to minimize space usage
    setWordWrap(true);

    // user can select several items at a time
    setSelectionMode(QAbstractItemView::SingleSelection);

    setEditTriggers(QAbstractItemView::DoubleClicked |
        QAbstractItemView::SelectedClicked |
        QAbstractItemView::EditKeyPressed |
        QAbstractItemView::AnyKeyPressed);

    setupActions();

    setMinimumHeight(MINIMUM_TABLE_HEIGHT);

}
QKeyValueListView::QKeyValueListView(QWidget *parent) : QTableWidget(parent)
{
    connect(this, SIGNAL(listUpdate(void)), this, SLOT(listUpdate_slot(void)));

    m_mutex = new QMutex();

    // set row & column numbers
    setRowCount(0);
    setColumnCount(2);

    // set no headers
    verticalHeader()->hide();
    horizontalHeader()->hide();

    // set last section is stretch-able
    QHeaderView *HorzHdr = horizontalHeader();
    HorzHdr->setStretchLastSection(true);
    HorzHdr->resizeSection(0, 80);     // set first column width

    // disable table edit & focus
    setEditTriggers(QTableWidget::NoEditTriggers);
    setFocusPolicy(Qt::NoFocus);
}
Exemplo n.º 4
0
/***********************************************************************
*
*   MyTableWidget stuff
*
************************************************************************/
MyTableWidget::MyTableWidget(QWidget* parent)
             : QTableWidget(parent)
{
  setDragEnabled(true);
  setAcceptDrops(true);
  horizontalHeader()->hide();
  horizontalHeader()->setStretchLastSection(true);
  verticalHeader()->hide();
  setSelectionBehavior(QAbstractItemView::SelectRows);
  setHorizontalScrollMode(ScrollPerPixel);
  setVerticalScrollMode(ScrollPerPixel);
  setEditTriggers(QAbstractItemView::NoEditTriggers);
  setGridStyle(Qt::NoPen);

  connect(this, SIGNAL(currentItemChanged(QTableWidgetItem *, QTableWidgetItem *))
  , this, SLOT(currentItemChangedSlot(QTableWidgetItem *, QTableWidgetItem *)));

  connect(this, SIGNAL(itemClicked(QTableWidgetItem *))
  , this, SLOT(itemClickedSlot(QTableWidgetItem *)));

  connect(this, SIGNAL(itemDoubleClicked(QTableWidgetItem *))
  , this, SLOT(itemDoubleClickedSlot(QTableWidgetItem *)));
}
Exemplo n.º 5
0
PlaylistView::PlaylistView(UDJServerConnection* serverConnection, MusicLibrary* musicLibrary, QWidget* parent):
  QTableView(parent),
  musicLibrary(musicLibrary),
  serverConnection(serverConnection)
{
  playlistModel = new PlaylistModel(serverConnection, this);
  horizontalHeader()->setStretchLastSection(true);
  setItemDelegateForColumn(6, new PlaylistDelegate(this));
  setModel(playlistModel);
  setColumnHidden(0,true);
  setColumnHidden(1,true);
  setColumnHidden(5,true);
  setSelectionBehavior(QAbstractItemView::SelectRows);
}
Exemplo n.º 6
0
int NavigableTableView::sizeHintForRow(int row) const {
  if (!model())
    return -1;

  ensurePolished();
  int left = qMax(0, horizontalHeader()->visualIndexAt(0));
  int right = horizontalHeader()->visualIndexAt(viewport()->width());

  if (right < 0) right = model()->columnCount();

  int hint = 0;

  for (int column = left; column <= right; ++column) {

    if (horizontalHeader()->isSectionHidden(column))
      continue;

    QModelIndex index = model()->index(row, column);
    hint = qMax(hint, itemDelegate(index)->sizeHint(viewOptions(), index).height());
  }

  return hint;
}
Exemplo n.º 7
0
void PivotTable::setPivotLength ( int row, double length )
{
    QTableWidgetItem* cell = item( row, 2 );
    QString len = QString("%1").arg( length, 0, 'f', 2 );
    if ( cell )
        cell->setData( Qt::EditRole, QVariant(len) );
    else {
        cell = new QTableWidgetItem;
        cell->setTextAlignment( Qt::AlignRight | Qt::AlignVCenter );
        cell->setData( Qt::EditRole, QVariant(len) );
        setItem( row, 2, cell );
    }
    horizontalHeader()->resizeSection( 2, Global::thicknessColumnWidth );
}
Exemplo n.º 8
0
void KColorCells::resizeEvent( QResizeEvent* )
{
    // According to the Qt doc:
    //   If you need to set the width of a given column to a fixed value, call
    //   QHeaderView::resizeSection() on the table's {horizontal,vertical}
    //   header.
    // Therefore we iterate over each row and column and set the header section
    // size, as the sizeHint does indeed appear to be ignored in favor of a
    // minimum size that is larger than what we want.
    for ( int index = 0 ; index < columnCount() ; index++ )
        horizontalHeader()->resizeSection( index, sizeHintForColumn( index ) );
    for ( int index = 0 ; index < rowCount() ; index++ )
        verticalHeader()->resizeSection( index, sizeHintForRow( index ) );
}
Exemplo n.º 9
0
TransactionViewTable::TransactionViewTable(QWidget *parent)
: QTableView(parent)
{

    setSelectionBehavior(QAbstractItemView::SelectItems);
    setSelectionMode(QAbstractItemView::NoSelection);
    setSortingEnabled(true);
    sortByColumn(TransactionTableModel::Date, Qt::DescendingOrder);
    verticalHeader()->hide();
    setShowGrid(false);

    // Turn manual resize grab handles off.
    horizontalHeader()->setResizeMode(QHeaderView::Fixed);
}
Exemplo n.º 10
0
ScreenSetupView::ScreenSetupView(QWidget* parent) :
	QTableView(parent)
{
	setDropIndicatorShown(true);
	setDragDropMode(DragDrop);
	setSelectionMode(SingleSelection);

	setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

	setIconSize(QSize(64, 64));
	horizontalHeader()->hide();
	verticalHeader()->hide();
}
Exemplo n.º 11
0
QFrozenRowTableWidget::QFrozenRowTableWidget(QWidget * parent) : QTableWidget(parent){
	frozenTableWidget = new QTableWidget(this);

	init();

	//connect the headers and scrollbars of both tableviews together
	connect(horizontalHeader(),SIGNAL(sectionResized(int,int,int)), this, SLOT(updateSectionWidth(int,int,int)));
	connect(verticalHeader(),SIGNAL(sectionResized(int,int,int)), this, SLOT(updateSectionHeight(int,int,int)));

	connect(frozenTableWidget->horizontalScrollBar(), SIGNAL(valueChanged(int)), horizontalScrollBar(), SLOT(setValue(int)));
	connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), frozenTableWidget->horizontalScrollBar(), SLOT(setValue(int)));

//	connect(this, SIGNAL(cellChanged(int, int)), this, SLOT(updateCellData(int, int)));
}
Exemplo n.º 12
0
QAccessibleInterface *QAccessibleTable::child(int logicalIndex) const
{
    if (!view()->model())
        return 0;

    if (childToId.contains(logicalIndex)) {
        QAccessible::Id id = childToId.value(logicalIndex);
        return QAccessible::accessibleInterface(id);
    }

    int vHeader = verticalHeader() ? 1 : 0;
    int hHeader = horizontalHeader() ? 1 : 0;

    int columns = view()->model()->columnCount() + vHeader;

    int row = logicalIndex / columns;
    int column = logicalIndex % columns;

    QAccessibleInterface *iface = 0;

    if (vHeader) {
        if (column == 0) {
            if (hHeader && row == 0) {
                iface = new QAccessibleTableCornerButton(view());
            } else {
                iface = new QAccessibleTableHeaderCell(view(), row - hHeader, Qt::Vertical);
            }
        }
        --column;
    }
    if (!iface && hHeader) {
        if (row == 0) {
            iface = new QAccessibleTableHeaderCell(view(), column, Qt::Horizontal);
        }
        --row;
    }

    if (!iface) {
        QModelIndex index = view()->model()->index(row, column, view()->rootIndex());
        if (!index.isValid()) {
            qWarning() << "QAccessibleTable::child: Invalid index at: " << row << column;
            return 0;
        }
        iface = new QAccessibleTableCell(view(), index, cellRole());
    }

    QAccessible::registerAccessibleInterface(iface);
    childToId.insert(logicalIndex, QAccessible::uniqueId(iface));
    return iface;
}
Exemplo n.º 13
0
void toResultTableView::setup(bool readable, bool numberColumn, bool editable)
{
    Statistics      = NULL;
    Menu            = NULL;
    ReadAll         = false;
    Filter          = NULL;
    VisibleColumns  = 0;
    ReadableColumns = readable;
    NumberColumn    = numberColumn;
    ColumnsResized  = false;
    Ready           = false;
    Finished        = false;

    Working = new toWorkingWidget(this);
    connect(Working, SIGNAL(stop()), this, SLOT(slotStop()));
    Working->hide(); // hide by default

    createActions();

    setSelectionBehavior(QAbstractItemView::SelectItems);
    setSelectionMode(QAbstractItemView::ContiguousSelection);
    setAlternatingRowColors(true);

    setContextMenuPolicy(Qt::CustomContextMenu);
    connect(this,
            SIGNAL(customContextMenuRequested(const QPoint &)),
            this,
            SLOT(slotDisplayMenu(const QPoint &)));
    connect(horizontalHeader(),
            SIGNAL(sectionResized(int, int, int)),
            this,
            SLOT(slotColumnWasResized(int, int, int)));
    connect(this,
            SIGNAL(doubleClicked(const QModelIndex &)),
            this,
            SLOT(slotHandleDoubleClick(const QModelIndex &)));

    setDragEnabled(true);
    setDropIndicatorShown(true);

    // this is my dirty hack to prevent fetchMore being called on the
    // model during a horizontal scroll.
    // this would be one great way to fix it, but as of this time it's
    // prioritized low and not scheduled for a fix:
    // https://bugreports.qt-project.org/browse/QTBUG-9988
    disconnect(QTableView::horizontalScrollBar(),
               SIGNAL(valueChanged(int)),
               this,
               SLOT(horizontalScrollbarValueChanged(int)));
}
Exemplo n.º 14
0
/** @brief Default constructor.
 * Initializes the object and does some UI-related things.
 *
 * @param parent pointer to the parent QWidget.
 */
View::View (QWidget *parent)
: QTableView (parent)
{
	QHeaderView *hh = horizontalHeader ();
	hh->setSortIndicatorShown (false);
	hh->setStretchLastSection (true);
	hh->setMovable (true);
	
	setShowGrid (false);
	setEditTriggers (QAbstractItemView::DoubleClicked);
	setSelectionBehavior (QAbstractItemView::SelectRows);
	setSelectionMode (QAbstractItemView::SingleSelection);
	setAlternatingRowColors (true);
}
Exemplo n.º 15
0
QSize LDFCommonTableWidget::GetTableWidgetSize()
{
    int w = verticalHeader()->width() + 4; // +4 seems to be needed
    for (int i = 0; i < columnCount(); i++)
    {
        w += columnWidth(i);    // seems to include gridline (on my machine)
    }
    int h = horizontalHeader()->height() + 4;
    for (int i = 0; i < rowCount(); i++)
    {
        h += rowHeight(i);
    }
    return QSize(w, h);
}
Exemplo n.º 16
0
QmitkModulesDialog::QmitkModulesDialog(QWidget *parent, Qt::WindowFlags f) :
    QDialog(parent, f)
{
  this->setWindowTitle("MITK Modules");

  auto  layout = new QVBoxLayout();
  this->setLayout(layout);

  auto  tableView = new QTableView(this);
  auto  tableModel = new QmitkModuleTableModel(tableView);
  auto  sortProxyModel = new QSortFilterProxyModel(tableView);
  sortProxyModel->setSourceModel(tableModel);
  sortProxyModel->setDynamicSortFilter(true);
  tableView->setModel(sortProxyModel);

  tableView->verticalHeader()->hide();
  tableView->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
  tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
  tableView->setSelectionMode(QAbstractItemView::ExtendedSelection);
  tableView->setTextElideMode(Qt::ElideMiddle);
  tableView->setSortingEnabled(true);
  tableView->sortByColumn(0, Qt::AscendingOrder);

  tableView->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
  tableView->horizontalHeader()->setSectionResizeMode(2, QHeaderView::ResizeToContents);
  tableView->horizontalHeader()->setStretchLastSection(true);
  tableView->horizontalHeader()->setCascadingSectionResizes(true);

  layout->addWidget(tableView);

  auto  btnBox = new QDialogButtonBox(QDialogButtonBox::Close);
  layout->addWidget(btnBox);

  this->resize(800, 600);

  connect(btnBox, SIGNAL(rejected()), this, SLOT(reject()));
}
Exemplo n.º 17
0
ConfRoomView::ConfRoomView(QWidget *parent, ConfRoomModel *model)
    : QTableView(parent)
{
    setSortingEnabled(true);
    setModel(model);
    setShowGrid(0);
    verticalHeader()->hide();
    horizontalHeader()->setMovable(true);
    horizontalHeader()->setStretchLastSection(true);

    int ActionCol[] = { ACTION_MUTE,
                        ACTION_TALK_TO,
                        ACTION_RECORD,
                        ACTION_ALLOW_IN,
                        ACTION_KICK };

    for(int i = 0; i < nelem(ActionCol); i++) {
        setColumnWidth(ActionCol[i], 32);
        horizontalHeader()->setResizeMode(ActionCol[i], QHeaderView::Fixed);
    }

    setColumnWidth(ADMIN, 60);
    horizontalHeader()->setResizeMode(ADMIN, QHeaderView::Fixed);
    setStyleSheet("ConfListView {"
                      "border: none;"
                      "background:transparent;"
                      "color:black;"
                  "}");
    hideColumn(0);

    connect(this, SIGNAL(clicked(const QModelIndex &)),
            this, SLOT(onViewClick(const QModelIndex &)));

    QHeaderView *h = horizontalHeader();
    connect(h, SIGNAL(sectionClicked(int)),
            this, SLOT(sectionHeaderClicked(int)));
}
Exemplo n.º 18
0
FileTransferWidget::FileTransferWidget(QWidget * pParent)
: KviTalTableWidget(pParent)
{
	//hide the header
	verticalHeader()->hide();
	//hide cells grids
	setShowGrid(false);
	//disable cell content editing
	setEditTriggers(QAbstractItemView::NoEditTriggers);

	//select one row at once
	setSelectionBehavior(QAbstractItemView::SelectRows);
	setSelectionMode(QAbstractItemView::SingleSelection);

	//prepare columns
	setColumnCount(3);

	QStringList colHeaders;
	colHeaders << __tr2qs_ctx("Type","filetransferwindow")
				<< __tr2qs_ctx("Information","filetransferwindow")
				<< __tr2qs_ctx("Progress","filetransferwindow");
	setHorizontalHeaderLabels(colHeaders);
	//default column widths
	setColumnWidth(0, FILETRANSFERW_CELLSIZE);
#if (QT_VERSION >= 0x050000)
	horizontalHeader()->setSectionResizeMode(0, QHeaderView::Fixed);
	horizontalHeader()->setSectionResizeMode(1, QHeaderView::Interactive);
#else
	horizontalHeader()->setResizeMode(0, QHeaderView::Fixed);
	horizontalHeader()->setResizeMode(1, QHeaderView::Interactive);
#endif
	setColumnWidth(1, 500);
	horizontalHeader()->setStretchLastSection(true);
	//focus policy
	setFocusPolicy(Qt::NoFocus);
	viewport()->setFocusPolicy(Qt::NoFocus);
}
Exemplo n.º 19
0
MyTable::MyTable(QWidget* parent)
    : QTableView(/*RowCount, ColumnCount, */ parent)
    , m_header(new MyHeader(Qt::Vertical, this))
    , m_model(new MyTableModel(this))
#ifdef EXCEL
    , excel(new Excel::Application(this))
#endif
{
    setModel(m_model);
    setVerticalHeader(m_header);

    connect(m_model, &MyTableModel::dataChanged, [=](const QModelIndex& topLeft, const QModelIndex& /*bottomRight*/, const QVector<int>& /*roles*/) {
        updatePlot(topLeft.row());
        resizeRowToContents(topLeft.row());
    });

    QAbstractButton* cornerButton = findChild<QAbstractButton*>();
    if (cornerButton) {
        c = new QCheckBox("№", cornerButton);
        c->setGeometry(cornerButton->rect() + QMargins(-5, 0, 100, 0));
        connect(c, &QCheckBox::toggled, [this](bool checked) { m_header->setChecked(checked); });
    }

    connect(m_header, &MyHeader::checkedChanged, m_model, &MyTableModel::setRowsEnabled);

    setColumnHidden(MeasureDeltaCh0, true);
    setColumnHidden(MeasureDeltaCh1, true);

    horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
    horizontalHeader()->setSectionResizeMode(MeasureCh0, QHeaderView::Stretch);
    horizontalHeader()->setSectionResizeMode(MeasureCh1, QHeaderView::Stretch);

    setIconSize(QSize(24, 24));
#ifdef EXCEL
    excel->SetVisible(true);
#endif
}
Exemplo n.º 20
0
void PropertyEditingTable::fill(QDomElement xml,
	QMap<QString, QString> values) {
QDomNodeList exprops = xml.elementsByTagName("property");
setRowCount(exprops.count());
for (int k = 0; k < exprops.count(); k++) {
	QDomElement exprop = exprops.at(k).toElement();

	QTableWidgetItem *item;

	item = new QTableWidgetItem(exprop.attribute("title"));
	QString propDesc = exprop.attribute("description");
	item->setFlags(Qt::ItemIsEnabled);
	if (!propDesc.isEmpty())
		item->setToolTip(propDesc);
	setItem(k, 0, item);

	QString val = exprop.attribute("default");
	QString propKey = exprop.attribute("name");
	QString propType = exprop.attribute("type");

	if (values.contains(propKey))
		val = values[propKey];

	PropDesc pdesc;
	pdesc.name=propKey;
	pdesc.type=propType;
	pdesc.value=val;
	props.append(pdesc);

	if (propType == "boolean") {
		QCheckBox *cb = new QCheckBox("");
		cb->setChecked(val.toInt() != 0);
		setCellWidget(k, 1, cb);
	} else {
		item = new QTableWidgetItem(val);
		setItem(k, 1, item);
	}

	if ((propType == "dir")||(propType == "file")) {
		QPushButton *bt = new QPushButton("Browse");
		mapper->setMapping(bt, k);
		connect(bt, SIGNAL(clicked()), mapper, SLOT(map()));
		setCellWidget(k, 2, bt);
	}

  }
  horizontalHeader()->resizeSections(QHeaderView::ResizeToContents);

}
void MusicVideoTableWidget::creatSearchedItems(const QString &songname,
                                               const QString &artistname,
                                               const QString &time)
{
    int count;
    setRowCount(count = m_downLoadManager->getSongIdIndex());
    QHeaderView *headerview = horizontalHeader();

    QTableWidgetItem *item = new QTableWidgetItem;
    item->setData(MUSIC_CHECK_ROLE, false);
    setItem(count - 1, 0, item);

                      item = new QTableWidgetItem;
    item->setText(QFontMetrics(font()).elidedText(songname, Qt::ElideRight,
                                                  headerview->sectionSize(1) - 5));
    item->setTextColor(QColor(50, 50, 50));
    item->setTextAlignment(Qt::AlignCenter);
    item->setToolTip(songname);
    setItem(count - 1, 1, item);

                      item = new QTableWidgetItem;
    item->setText(QFontMetrics(font()).elidedText(artistname, Qt::ElideRight,
                                                  headerview->sectionSize(2) - 5));
    item->setTextColor(QColor(50, 50, 50));
    item->setTextAlignment(Qt::AlignCenter);
    item->setToolTip(artistname);
    setItem(count - 1, 2, item);

                      item = new QTableWidgetItem;
    item->setIcon(QIcon(randToGetStrength()));
    setItem(count - 1, 3, item);

                      item = new QTableWidgetItem(time);
    item->setTextColor(QColor(50, 50, 50));
    item->setTextAlignment(Qt::AlignCenter);
    setItem(count - 1, 4, item);

                      item = new QTableWidgetItem;
    item->setIcon(QIcon(QString::fromUtf8(":/share/showMV")));
    setItem(count - 1, 5, item);

                      item = new QTableWidgetItem;
    item->setIcon(QIcon(QString::fromUtf8(":/share/autionplay")));
    setItem(count - 1, 6, item);

                      item = new QTableWidgetItem;
    item->setIcon(QIcon(QString::fromUtf8(":/share/musicdownload")));
    setItem(count - 1, 7, item);
}
Exemplo n.º 22
0
void PoitemTableView::setModel(QAbstractItemModel* model)
{

  QTableView::setModel(model);

  setColumnWidth(ITEM_NUMBER_COL,		_itemColumn);
  setColumnWidth(WAREHOUS_CODE_COL,		100); //_whsColumn too small
  setColumnWidth(POITEM_QTY_ORDERED_COL,	_qtyColumn);
  setColumnWidth(POITEM_UNITPRICE_COL,		_priceColumn);
  setColumnWidth(EXTPRICE_COL,			_moneyColumn);
  setColumnWidth(POITEM_FREIGHT_COL,		_priceColumn);
  setColumnWidth(POITEM_DUEDATE_COL,		_dateColumn);
#ifdef QE_PROJECT
  setColumnWidth(PRJ_NUMBER_COL,		100);
#endif
#ifdef QE_NONINVENTORY
  setColumnWidth(EXPCAT_CODE_COL,		100);
#endif
  setColumnWidth(POITEM_VEND_ITEM_NUMBER_COL,	_itemColumn);

  QHeaderView *header = horizontalHeader();

  int dest = 0;
  header->moveSection(header->visualIndex(ITEM_NUMBER_COL),	 	dest++);
  header->moveSection(header->visualIndex(WAREHOUS_CODE_COL),		dest++);
  header->moveSection(header->visualIndex(POITEM_VEND_ITEM_NUMBER_COL),	dest++);
#ifdef QE_NONINVENTORY
  header->moveSection(header->visualIndex(EXPCAT_CODE_COL),		dest++);
#endif
  header->moveSection(header->visualIndex(POITEM_QTY_ORDERED_COL),	dest++);
  header->moveSection(header->visualIndex(POITEM_UNITPRICE_COL),	dest++);
  header->moveSection(header->visualIndex(EXTPRICE_COL),		dest++);
  header->moveSection(header->visualIndex(POITEM_FREIGHT_COL),		dest++);
  header->moveSection(header->visualIndex(POITEM_DUEDATE_COL),		dest++);
#ifdef QE_PROJECT
  header->moveSection(header->visualIndex(PRJ_NUMBER_COL),		dest++);
#endif

  // if we didn't explicitly place the logical section, hide it
  for (int i = dest; i < header->count(); i++)
    header->hideSection(header->logicalIndex(i));

#ifdef QE_PROJECT
  if (! _metrics->boolean("UseProjects"))
    header->hideSection(header->visualIndex(PRJ_NUMBER_COL));
#endif

  //header->setStretchLastSection(true);
}
Exemplo n.º 23
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));
        }
    }
}
Exemplo n.º 24
0
void MailListView::writeConfig( QSettings *conf)
{
    QString temp;
    if (!singleColumnMode()) {
        for (int x = 0; x < columnCount(); x++) {
            temp.setNum(x);
            conf->setValue("querycol" + temp, columnWidth(x) );
            conf->setValue("querycollabelpos" + temp, labelPos(x) );
        }
        conf->setValue( "querycolsort", sortedColumn() );
        conf->setValue( "querycolsortascending", isAscending() );
        conf->setValue( "arrivaldate", arrivalDate() );
        conf->setValue( "showheader", horizontalHeader()->isHidden() );
    }
}
Exemplo n.º 25
0
	/** Constructor */
	FileBrowser::FileBrowser(QWidget* parent) : QTableView(parent)
	{
		Settings settings;
		libRoot = settings.value(LIB_ROOT_KEY, DEFAULT_LIB_ROOT).toString();

		fsModel = new QFileSystemModel(this);
		fsModel->setFilter(QDir::AllEntries | QDir::AllDirs | QDir::NoDot); // Want ..

		setSelectionMode(QTableView::SingleSelection);
		setSelectionBehavior(QTableView::SelectRows);
		setShowGrid(false);
		setSortingEnabled(true);

		setModel(fsModel);
		horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
		horizontalHeader()->setSectionResizeMode(3, QHeaderView::ResizeToContents);
		verticalHeader()->setVisible(false);
		setRootIndex(fsModel->setRootPath(libRoot));

		connect(this, SIGNAL(activated(QModelIndex)),
			this, SLOT(handleDoubleClick(QModelIndex)));
		connect(selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
			this, SLOT(handleSelection(QModelIndex,QModelIndex)));
	}
Exemplo n.º 26
0
QgsAttributeTableView::QgsAttributeTableView( QWidget* parent )
    : QTableView( parent ), mModel( 0 ), mFilterModel( 0 ), mActionPopup( 0 )
{
  QSettings settings;
  restoreGeometry( settings.value( "/BetterAttributeTable/geometry" ).toByteArray() );

  verticalHeader()->setDefaultSectionSize( 20 );
  horizontalHeader()->setHighlightSections( false );

  setItemDelegate( new QgsAttributeTableDelegate( this ) );

  setSelectionBehavior( QAbstractItemView::SelectRows );
  setSelectionMode( QAbstractItemView::NoSelection );
  setSortingEnabled( true );
}
Exemplo n.º 27
0
QgsAttributeTableView::QgsAttributeTableView( QWidget *parent )
    : QTableView( parent )
    , mMasterModel( nullptr )
    , mFilterModel( nullptr )
    , mFeatureSelectionModel( nullptr )
    , mFeatureSelectionManager( nullptr )
    , mModel( nullptr )
    , mActionPopup( nullptr )
    , mRowSectionAnchor( 0 )
    , mCtrlDragSelectionFlag( QItemSelectionModel::Select )
    , mActionWidget( nullptr )
{
  QSettings settings;
  restoreGeometry( settings.value( "/BetterAttributeTable/geometry" ).toByteArray() );

  //verticalHeader()->setDefaultSectionSize( 20 );
  horizontalHeader()->setHighlightSections( false );

  // We need mouse move events to create the action button on hover
  setMouseTracking( true );

  mTableDelegate = new QgsAttributeTableDelegate( this );
  setItemDelegate( mTableDelegate );

  setSelectionBehavior( QAbstractItemView::SelectRows );
  setSelectionMode( QAbstractItemView::ExtendedSelection );
  setSortingEnabled( true ); // At this point no data is in the model yet, so actually nothing is sorted.
  horizontalHeader()->setSortIndicatorShown( false ); // So hide the indicator to avoid confusion.

  verticalHeader()->viewport()->installEventFilter( this );

  connect( verticalHeader(), SIGNAL( sectionPressed( int ) ), this, SLOT( selectRow( int ) ) );
  connect( verticalHeader(), SIGNAL( sectionEntered( int ) ), this, SLOT( _q_selectRow( int ) ) );
  connect( horizontalHeader(), SIGNAL( sectionResized( int, int, int ) ), this, SLOT( columnSizeChanged( int, int, int ) ) );
  connect( horizontalHeader(), SIGNAL( sortIndicatorChanged( int, Qt::SortOrder ) ), this, SLOT( showHorizontalSortIndicator() ) );
}
PreviewTable::PreviewTable(int numRows, int numCols, QWidget * parent, const char * name)
:Q3Table(numRows, numCols, parent, name)
{
	setAttribute(Qt::WA_DeleteOnClose);
	setSelectionMode(Q3Table::NoSelection);
	setReadOnly(true);
	setRowMovingEnabled(false);
	setColumnMovingEnabled(false);
	verticalHeader()->setResizeEnabled(false);
	horizontalHeader()->installEventFilter(this);
	horizontalHeader()->setResizeEnabled(true);
	horizontalHeader()->setMovingEnabled (false);

	for (int i = 0; i < numCols; i++){
		comments << "";
		col_label << QString::number(i + 1);
		colTypes << Table::Numeric;
	}

	d_start_col = numCols;
	setHeader();
	setMinimumHeight(2*horizontalHeader()->height());
	connect(horizontalHeader(), SIGNAL(sizeChange(int, int, int)), this, SLOT(setHeader()));
}
Exemplo n.º 29
0
void	My_Layers::resizeEvent(QResizeEvent *e) 
    {
		switch(tipo_tabella)
		{
		case 'V':
			{
                        setColumnWidth(1,30);
                        setColumnWidth(2,30);

			QHeaderView *hh = horizontalHeader();
                        hh->resizeSection(0,viewport()->width() - 60);
			}
			break;
		case 'P':
                case 'G':
			{
                        setColumnWidth(1,30);
					
			QHeaderView *hh = horizontalHeader();
                        hh->resizeSection(0,viewport()->width() - 30);
			}
			break;
                 }
    }
Exemplo n.º 30
0
void RuleTableView::init() {

    setColumnWidth(0,150);
    setSelectionMode(QTableView::SingleSelection);
    setEditTriggers(QAbstractItemView::CurrentChanged | QAbstractItemView::SelectedClicked);
    setAlternatingRowColors(true);
    verticalHeader()->hide();
    verticalHeader()->setDefaultSectionSize(30);
    horizontalHeader()->setStretchLastSection(true);

    ruleDelegate = new RuleTableDelegate(this);
    setItemDelegateForColumn(1,ruleDelegate);
    setItemDelegateForColumn(3,ruleDelegate);
    setItemDelegateForColumn(4,ruleDelegate);
}