本文整理汇总了C++中Q3Header类的典型用法代码示例。如果您正苦于以下问题:C++ Q3Header类的具体用法?C++ Q3Header怎么用?C++ Q3Header使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Q3Header类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: horizontalHeader
void PreviewTable::setHeader()
{
Q3Header *head = horizontalHeader();
for (int i=0; i<numCols(); i++){
QString s = col_label[i];
int lines = columnWidth(i)/head->fontMetrics().boundingRect("_").width();
head->setLabel(i, s.remove("\n") + "\n" + QString(lines, '_') + "\n" + comments[i]);
}
}
示例2: horizontalHeader
void PreviewTable::setHeader()
{
Q3Header *head = horizontalHeader();
for (int i=0; i<numCols(); i++){
QString s = col_label[i];
int lines = columnWidth(i)/head->fontMetrics().averageCharWidth();
#ifdef Q_OS_MAC
head->setLabel(i, s.remove("\n"));
#else
head->setLabel(i, s.remove("\n") + "\n" + QString(lines, '_') + "\n" + comments[i]);
#endif
}
}
示例3: Q_ASSERT
bool Q3ListViewExtraInfo::saveWidgetExtraInfo(DomWidget *ui_widget)
{
// ### finish me
Q3ListView *listView = qobject_cast<Q3ListView*>(widget());
Q_ASSERT(listView != 0);
QList<DomColumn*> columns;
Q3Header *header = listView->header();
for (int i=0; i<header->count(); ++i) {
DomColumn *c = new DomColumn();
QList<DomProperty*> properties;
DomString *str = new DomString();
str->setText(header->label(i));
DomProperty *ptext = new DomProperty();
ptext->setAttributeName(QLatin1String("text"));
ptext->setElementString(str);
DomProperty *pclickable = new DomProperty();
pclickable->setAttributeName(QLatin1String("clickable"));
pclickable->setElementBool(header->isClickEnabled(i) ? QLatin1String("true") : QLatin1String("false"));
DomProperty *presizable = new DomProperty();
presizable->setAttributeName(QLatin1String("resizable"));
presizable->setElementBool(header->isResizeEnabled(i) ? QLatin1String("true") : QLatin1String("false"));
properties.append(ptext);
properties.append(pclickable);
properties.append(presizable);
c->setElementProperty(properties);
columns.append(c);
}
ui_widget->setElementColumn(columns);
QList<DomItem *> items;
Q3ListViewItem *child = listView->firstChild();
while (child) {
items.append(saveQ3ListViewItem(child));
child = child->nextSibling();
}
ui_widget->setElementItem(items);
return true;
}
示例4: horizontalHeader
bool PreviewTable::eventFilter(QObject *object, QEvent *e)
{
Q3Header *hheader = horizontalHeader();
if (e->type() == QEvent::MouseButtonPress && object == (QObject*)hheader) {
const QMouseEvent *me = (const QMouseEvent *)e;
clearSelection();
int col = hheader->sectionAt (me->pos().x() + hheader->offset());
if (col >= 0 && col < numCols()){
QRect rect = hheader->sectionRect(col);
rect.setLeft(rect.left() + 2);
rect.setRight(rect.right() - 2);
if (rect.contains (me->pos())){
selectColumn(col);
d_selected_column = col;
showColTypeDialog();
return true;
}
}
}
return Q3Table::eventFilter(object, e);
}
示例5: Init
int CarListVisual::Init(const std::map<QString, QString> & mapParams)
{
if (TableVisualizer::Init(mapParams))
return 1;
QDraggingTable * pTable = ((QTableVisualizer *)m_pWidget)->m_pTable;
pTable->setNumCols(7);
Q3Header * pHHeader = pTable->horizontalHeader();
pHHeader->setMovingEnabled(false);
pHHeader->setLabel(0, "");
pTable->setColumnWidth(0, 32);
pHHeader->setLabel(1, "Vehicle");
pTable->setColumnWidth(1, 120);
pHHeader->setLabel(2, "Type");
pTable->setColumnWidth(2, 150);
pHHeader->setLabel(3, "Longitude");
pTable->setColumnWidth(3, 120);
pHHeader->setLabel(4, "Latitude");
pTable->setColumnWidth(4, 120);
pHHeader->setLabel(5, "Speed");
pTable->setColumnWidth(5, 70);
pHHeader->setLabel(6, "Heading");
pTable->setColumnWidth(6, 90);
pTable->verticalHeader()->hide();
pTable->setColumnMovingEnabled(false);
pTable->setFocusStyle(Q3Table::FollowStyle);
pTable->setLeftMargin(0);
pTable->setReadOnly(true);
pTable->setRowMovingEnabled(false);
pTable->setSelectionMode(Q3Table::SingleRow);
pTable->setShowGrid(true);
pTable->setSorting(false);
pTable->SetDragObjectCreator(CarListVisualDragObjectCreator, this);
pTable->setDragEnabled(true);
m_pRightClickMenu = new Q3PopupMenu(pTable);
m_pRightClickMenu->insertItem("Send Message...", 0);
UpdateTable();
return 0;
}
示例6: headerItem
void toListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
{
#if 0 // todo
QPoint p = e->pos();
int col = headerItem()->sectionAt(p.x());
toTreeWidgetItem *item = itemAt(contentsToViewport(p));
toResultViewItem *resItem = dynamic_cast<toResultViewItem *>(item);
toResultViewCheck *chkItem = dynamic_cast<toResultViewCheck *>(item);
QClipboard *clip = qApp->clipboard();
if (resItem)
clip->setText(resItem->allText(col));
else if (chkItem)
clip->setText(chkItem->allText(col));
else if (item)
clip->setText(item->text(col));
Q3Header *head = header();
for (int i = 0; i < columns(); i++)
{
QString str;
if (resItem)
str = resItem->allText(i);
else if (chkItem)
str = chkItem->allText(col);
else if (item)
str = item->text(i);
try
{
toParamGet::setDefault(toCurrentConnection(this),
head->label(i).lower(), toUnnull(str));
}
catch (...) {}
}
toTreeWidget::contentsMouseDoubleClickEvent(e);
#endif
}
示例7: QDialog
/*
* Constructs a ProcessVarGui which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*
* The dialog will by default be modeless, unless you set 'modal' to
* TRUE to construct a modal dialog.
*/
ProcessVarGui::ProcessVarGui(QWidget* parent)
: QDialog(parent),
_ui(new Ui::ProcessVarGui) {
_ui->setupUi(this);
Q3Header *header;
header = _ui->rxTable->horizontalHeader( );
for( int i=0; i<2; i++ ) {
header->setLabel( 0, "State" );
header->setLabel( 1, "Count" );
header->setLabel( 2, "D0" );
header->setLabel( 3, "D1" );
header->setLabel( 4, "D2" );
header->setLabel( 5, "D3" );
header->setLabel( 6, "D4" );
header->setLabel( 7, "D5" );
header->setLabel( 8, "D6" );
header->setLabel( 9, "D7" );
header = _ui->txTable->horizontalHeader( );
}
header = _ui->rxTable->verticalHeader( );
for( int i=0; i<2; i++ ) {
header->setLabel( 0, "PDO1" );
header->setLabel( 1, "PDO2" );
header->setLabel( 2, "PDO3" );
header->setLabel( 3, "PDO4" );
header = _ui->txTable->verticalHeader( );
}
for( int i=0; i<_ui->rxTable->numCols( ); i++ ) {
_ui->rxTable->adjustColumn( i );
}
for( int i=0; i<_ui->txTable->numCols( ); i++ ) {
_ui->txTable->adjustColumn( i );
}
// signals and slots connections
connect( _ui->canopenPVarViewIdentifier, SIGNAL( valueChanged(int) ), this, SLOT( canopenIdChanged( ) ) );
connect( _ui->PushButton1, SIGNAL( clicked() ), this, SLOT( canopenIdChanged( ) ) );
// fill in data of canopen-Device 0
fillInData( 0 );
}
示例8: QWidget
TesterReport::TesterReport (QWidget *p) : QWidget (p)
{
Q3VBoxLayout *vbox = new Q3VBoxLayout(this);
vbox->setMargin(5);
vbox->setSpacing(5);
tradeTable = new Q3Table(0, 9, this);
tradeTable->setSelectionMode(Q3Table::Single);
tradeTable->setSorting(FALSE);
Q3Header *header = tradeTable->horizontalHeader();
header->setLabel(0, tr("Type"), 40);
header->setLabel(1, tr("Entry"), 80);
header->setLabel(2, tr("Entry Price"), 70);
header->setLabel(3, tr("Exit"), 80);
header->setLabel(4, tr("Exit Price"), 70);
header->setLabel(5, tr("Signal"), -1);
header->setLabel(6, tr("Profit"), -1);
header->setLabel(7, tr("Balance"), -1);
header->setLabel(8, tr("Vol"), -1);
vbox->addWidget(tradeTable);
int loop;
for (loop = 0; loop < 9; loop++)
tradeTable->setColumnReadOnly(loop, TRUE);
// test summary
Q3HBoxLayout *hbox = new Q3HBoxLayout(vbox);
hbox->setSpacing(5);
Q3VGroupBox *gbox = new Q3VGroupBox(tr("Test Summary"), this);
gbox->setInsideSpacing(2);
gbox->setColumns(2);
hbox->addWidget(gbox);
QLabel *label = new QLabel(tr("Account Balance "), gbox);
summaryBalance = new QLabel(" ", gbox);
label = new QLabel(tr("Net Profit "), gbox);
summaryNetProfit = new QLabel(" ", gbox);
label = new QLabel(tr("Net Profit % "), gbox);
summaryNetPercentage = new QLabel(" ", gbox);
label = new QLabel(tr("Initial Investment "), gbox);
summaryInvestment = new QLabel(" ", gbox);
label = new QLabel(tr("Commissions "), gbox);
summaryCommission = new QLabel(" ", gbox);
label = new QLabel(tr("Largest Drawdown "), gbox);
summaryDrawdown = new QLabel(" ", gbox);
label = new QLabel(tr("Trades "), gbox);
summaryTrades = new QLabel(" ", gbox);
label = new QLabel(tr("Long Trades "), gbox);
summaryLongTrades = new QLabel(" ", gbox);
label = new QLabel(tr("Short Trades "), gbox);
summaryShortTrades = new QLabel(" ", gbox);
// win summary
gbox = new Q3VGroupBox(tr("Win Summary"), this);
gbox->setInsideSpacing(2);
gbox->setColumns(2);
hbox->addWidget(gbox);
label = new QLabel(tr("Trades "), gbox);
summaryWinTrades = new QLabel(" ", gbox);
label = new QLabel(tr("Profit "), gbox);
summaryTotalWinTrades = new QLabel(" ", gbox);
label = new QLabel(tr("Average "), gbox);
summaryAverageWin = new QLabel(" ", gbox);
label = new QLabel(tr("Largest "), gbox);
summaryLargestWin = new QLabel(" ", gbox);
label = new QLabel(tr("Long Trades "), gbox);
summaryWinLongTrades = new QLabel(" ", gbox);
label = new QLabel(tr("Short Trades "), gbox);
summaryWinShortTrades = new QLabel(" ", gbox);
// lose summary
gbox = new Q3VGroupBox(tr("Lose Summary"), this);
gbox->setInsideSpacing(2);
gbox->setColumns(2);
hbox->addWidget(gbox);
label = new QLabel(tr("Trades "), gbox);
summaryLoseTrades = new QLabel(" ", gbox);
label = new QLabel(tr("Loss "), gbox);
summaryTotalLoseTrades = new QLabel(" ", gbox);
label = new QLabel(tr("Average "), gbox);
summaryAverageLose = new QLabel(" ", gbox);
//.........这里部分代码省略.........