WatchersDialog::WatchersDialog(KConfig& cfg, QWidget* parent, const char* name) : KDialogBase(parent, name, false, QString::null, Close, ButtonCode(0), true) , partConfig(cfg) { QFrame* mainWidget = makeMainWidget(); QBoxLayout *layout = new QVBoxLayout(mainWidget, 0, spacingHint()); table = new QTable(mainWidget, "watchersTable"); table->setNumCols(5); table->setSelectionMode(QTable::NoSelection); table->setColumnMovingEnabled(false); table->setRowMovingEnabled(false); table->setReadOnly(true); table->setDragEnabled(false); table->setSorting(true); table->verticalHeader()->hide(); table->setLeftMargin(0); QHeader* header = table->horizontalHeader(); header->setLabel(0, i18n("File")); header->setLabel(1, i18n("Watcher")); header->setLabel(2, i18n("Edit")); header->setLabel(3, i18n("Unedit")); header->setLabel(4, i18n("Commit")); layout->addWidget(table, 1); setWFlags(Qt::WDestructiveClose | getWFlags()); QSize size = configDialogSize(partConfig, "WatchersDialog"); resize(size); }
/****************************************************************************** * Sets the last column in the list view to extend at least to the right hand * edge of the list view. */ void EventListViewBase::resizeLastColumn() { int lastColumnWidth = mLastColumnHeaderWidth; for (EventListViewItemBase* item = firstChild(); item; item = item->nextSibling()) { int mw = item->lastColumnWidth(); if (mw > lastColumnWidth) lastColumnWidth = mw; } QHeader* head = header(); int x = head->sectionPos(mLastColumn); int availableWidth = visibleWidth() - x; int rightColWidth = 0; int index = head->mapToIndex(mLastColumn); if (index < mLastColumn) { // The last column has been dragged by the user to a different position. // Ensure that the columns now to the right of it are still shown. for (int i = index + 1; i <= mLastColumn; ++i) rightColWidth += columnWidth(head->mapToSection(i)); availableWidth -= rightColWidth; } if (availableWidth < lastColumnWidth) availableWidth = lastColumnWidth; setColumnWidth(mLastColumn, availableWidth); if (contentsWidth() > x + availableWidth + rightColWidth) resizeContents(x + availableWidth + rightColWidth, contentsHeight()); }
void ListViewEditor::setupColumns() { QHeader *h = listview->header(); for ( int i = 0; i < (int)h->count(); ++i ) { Column col; col.text = h->label( i ); col.pixmap = QPixmap(); if ( h->iconSet( i ) ) col.pixmap = h->iconSet( i )->pixmap(); col.clickable = h->isClickEnabled( i ); col.resizable = h->isResizeEnabled( i ); if ( !col.pixmap.isNull() ) col.item = new QListBoxPixmap( colPreview, col.pixmap, col.text ); else col.item = new QListBoxText( colPreview, col.text ); columns.append( col ); } colText->setEnabled( FALSE ); colPixmap->setEnabled( FALSE ); colClickable->setEnabled( FALSE ); colResizable->setEnabled( FALSE ); if ( colPreview->firstItem() ) colPreview->setCurrentItem( colPreview->firstItem() ); numColumns = colPreview->count(); }
GUITabla::GUITabla(int filas, QStringList encabezado, QWidget *parent, const char *name) :QTable(parent, name) { QHeader *header = horizontalHeader(); { header->setMovingEnabled(true); setNumCols(encabezado.count()); setNumRows(filas); for(uint i = 0; i < encabezado.count(); i++) { header->setLabel( i, tr(encabezado[i]) ); adjustColumn(i); } connect(this, SIGNAL(valueChanged(int,int) ), SLOT(ajustarTamano(int, int))); show(); } setReadOnly ( true ); }
void KVocTrainTable::menuTriggerTimeout() { delayTimer->stop(); if (triggerSect == -1) return; int mt = triggerSect; triggerSect = -1; QHeader *header = horizontalHeader(); int x = leftMargin(); for (int i = 0; i < mt; ++i) x += header->sectionSize(i); QPoint mpos = mapToGlobal(QPoint(x, topMargin())); if (mt != KV_COL_MARK) emit rightButtonClicked(mt, mpos.x(), mpos.y()); QMouseEvent me(QEvent::MouseButtonRelease, QPoint(0, 0), QMouseEvent::LeftButton, QMouseEvent::LeftButton); QApplication::sendEvent(header, &me); }
void ListViewEditor::setupItems() { itemColumn->setMinValue( 0 ); itemColumn->setMaxValue( QMAX( numColumns - 1, 0 ) ); int i = 0; QHeader *header = itemsPreview->header(); for ( QListBoxItem *item = colPreview->firstItem(); item; item = item->next() ) { Column *col = findColumn( item ); if ( !col ) continue; if ( i >= itemsPreview->columns() ) itemsPreview->addColumn( col->text ); header->setLabel( i, col->pixmap, col->text ); header->setResizeEnabled( col->resizable, i ); header->setClickEnabled( col->clickable, i ); ++i; } while ( itemsPreview->columns() > i ) itemsPreview->removeColumn( i ); itemColumn->setValue( QMIN( numColumns - 1, itemColumn->value() ) ); }
// Constructor. qsamplerChannelRoutingTable::qsamplerChannelRoutingTable ( QWidget *pParent, const char *pszName ) : QTable(pParent, pszName) { // Set fixed number of columns. QTable::setNumCols(2); QTable::setShowGrid(false); QTable::setSorting(false); QTable::setFocusStyle(QTable::FollowStyle); QTable::setSelectionMode(QTable::NoSelection); // No vertical header. QTable::verticalHeader()->hide(); QTable::setLeftMargin(0); // Initialize the fixed table column headings. QHeader *pHeader = QTable::horizontalHeader(); pHeader->setLabel(0, tr("Sampler Channel")); pHeader->setLabel(1, tr("Device Channel")); // Set read-onlyness of each column QTable::setColumnReadOnly(0, true); // QTable::setColumnReadOnly(1, false); -- of course not. QTable::setColumnStretchable(1, true); }
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); QHeader * 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(QTable::FollowStyle); pTable->setLeftMargin(0); pTable->setReadOnly(true); pTable->setRowMovingEnabled(false); pTable->setSelectionMode(QTable::SingleRow); pTable->setShowGrid(true); pTable->setSorting(false); pTable->SetDragObjectCreator(CarListVisualDragObjectCreator, this); pTable->setDragEnabled(true); m_pRightClickMenu = new QPopupMenu(pTable); m_pRightClickMenu->insertItem("Send Message...", 0); UpdateTable(); return 0; }
void isiTapResults::adjustTableColumnWidth() { QRect rc; QHeader *header; QString qText; int nColumn, nRow, nWidth, nWtd; int nRows = IDC_CHAN->numRows(); for(nColumn=0; nColumn<5; ++nColumn) { header = IDC_CHAN->horizontalHeader(); qText = IDC_CHAN->text(0, nColumn); GetTextRectangle(IDC_CHAN,qText, rc); nWidth = header->sectionSize(nColumn); for(nRow=1; nRow<nRows; ++nRow) { qText = IDC_CHAN->text(0, nColumn); GetTextRectangle(IDC_CHAN,qText, rc); nWtd = rc.width()+4; if(nWidth < nWtd) nWidth = nWtd; } header->resizeSection(nColumn, nWidth); } }
/****************************************************************************** * Return the column order. */ QValueList<int> AlarmListView::columnOrder() const { QHeader *hdr = header(); int order[COLUMN_COUNT]; order[TIME_COLUMN] = hdr->mapToIndex(mColumn[TIME_COLUMN]); order[TIME_TO_COLUMN] = hdr->mapToIndex(mColumn[TIME_TO_COLUMN]); order[REPEAT_COLUMN] = hdr->mapToIndex(mColumn[REPEAT_COLUMN]); order[COLOUR_COLUMN] = hdr->mapToIndex(mColumn[COLOUR_COLUMN]); order[TYPE_COLUMN] = hdr->mapToIndex(mColumn[TYPE_COLUMN]); order[MESSAGE_COLUMN] = hdr->mapToIndex(mColumn[MESSAGE_COLUMN]); QValueList<int> orderList; for(int i = 0; i < COLUMN_COUNT; ++i) orderList += order[i]; return orderList; }
void TableEditor::readFromTable() { #ifndef QT_NO_TABLE QHeader *cols = editTable->horizontalHeader(); table->setNumCols( cols->count() ); QMap<QString, QString> columnFields = MetaDataBase::columnFields( editTable ); for ( int i = 0; i < cols->count(); ++i ) { if ( editTable->horizontalHeader()->iconSet( i ) ) { table->horizontalHeader()->setLabel( i, *editTable->horizontalHeader()->iconSet( i ), editTable->horizontalHeader()->label( i ) ); listColumns->insertItem( editTable->horizontalHeader()->iconSet( i )->pixmap(), editTable->horizontalHeader()->label( i ) ); } else { table->horizontalHeader()->setLabel( i, editTable->horizontalHeader()->label( i ) ); listColumns->insertItem( editTable->horizontalHeader()->label( i ) ); } QString cf = *columnFields.find( editTable->horizontalHeader()->label( i ) ); fieldMap.insert( i, cf ); } if ( listColumns->firstItem() ) { listColumns->setCurrentItem( listColumns->firstItem() ); listColumns->setSelected( listColumns->firstItem(), TRUE ); } QHeader *rows = editTable->verticalHeader(); table->setNumRows( rows->count() ); for ( int j = 0; j < rows->count(); ++j ) { if ( editTable->verticalHeader()->iconSet( j ) ) { table->verticalHeader()->setLabel( j, *editTable->verticalHeader()->iconSet( j ), editTable->verticalHeader()->label( j ) ); listRows->insertItem( editTable->verticalHeader()->iconSet( j )->pixmap(), editTable->verticalHeader()->label( j ) ); } else { table->verticalHeader()->setLabel( j, editTable->verticalHeader()->label( j ) ); listRows->insertItem( editTable->verticalHeader()->label( j ) ); } } if ( listRows->firstItem() ) { listRows->setCurrentItem( listRows->firstItem() ); listRows->setSelected( listRows->firstItem(), TRUE ); } #endif }
ClsQHarborImpl::ClsQHarborImpl(QWidget* parent, const char* name, bool modal, WFlags fl): ClsQHarbor(parent, name,modal, fl) { setAcceptDrops(TRUE); QHeader *th = qtableEntries->horizontalHeader(); th->setLabel( COL_TYPE, "Type" ); th->setLabel( COL_NAME, "Name" ); th->setLabel( COL_ID, "ID" ); th->setLabel( COL_CHILD, "Child" ); th->setLabel( COL_PARAM_LABEL, "Parameter" ); th->setLabel( COL_MIN, "Min"); th->setLabel( COL_MAX, "Max"); th->setLabel( COL_VALUE, "Value"); qtableEntries->hideColumn(COL_PARAM_NAME); bSimulationRunning = false; clsItem = NULL; mapParams.clear(); void (); void (); void (); connect(pbDeleteRow, SIGNAL(clicked()), SLOT(slotDeleteRow())); connect(pbSaveConfig, SIGNAL(clicked()), SLOT(slotSaveConfig())); connect(pbLoadConfig, SIGNAL(clicked()), SLOT(slotLoadConfig())); connect(pbSaveParamSet, SIGNAL(clicked()), SLOT(slotSaveParamSet())); connect(pbLoadParamSet, SIGNAL(clicked()), SLOT(slotLoadParamSet())); connect(pbRefresh, SIGNAL(clicked()), SLOT(slotRefresh())); connect(qtableEntries, SIGNAL(doubleClicked(int, int, int, const QPoint &)), SLOT(slotCellDoubleClicked(int, int, int, const QPoint &))); }
KDE_NO_CDTOR_EXPORT KMPlayerPrefBroadcastFormatPage::KMPlayerPrefBroadcastFormatPage (QWidget *parent, FFServerSettingList & ffs) : QFrame (parent, "BroadcastPage"), profiles (ffs) { QHBoxLayout *layout = new QHBoxLayout (this, 5); QGridLayout *formatlayout = new QGridLayout (11, 2, 2); formatlayout->setAlignment (Qt::AlignTop); QVBoxLayout *leftlayout = new QVBoxLayout (15); QHBoxLayout *ledlayout = new QHBoxLayout (5); format = new QComboBox (this); QLabel * label = new QLabel (format, i18n ("Format:"), this); format->clear (); format->insertItem (QString ("asf")); format->insertItem (QString ("avi")); format->insertItem (QString ("mpjpeg")); format->insertItem (QString ("mpeg")); format->insertItem (QString ("rm")); format->insertItem (QString ("swf")); QWhatsThis::add (format, i18n ("Only avi, mpeg and rm work for mplayer playback")); formatlayout->addWidget (label, 0, 0); formatlayout->addWidget (format, 0, 1); ADDPROPERTY (i18n ("Audio codec:"), audiocodec, formatlayout, 1, this); ADDPROPERTY (i18n ("Audio bit rate (kbit):"), audiobitrate, formatlayout, 2, this); ADDPROPERTY (i18n ("Audio sample rate (Hz):"), audiosamplerate, formatlayout, 3, this); ADDPROPERTY (i18n ("Video codec:"), videocodec, formatlayout, 4, this); ADDPROPERTY (i18n ("Video bit rate (kbit):"), videobitrate, formatlayout, 5, this); ADDPROPERTY (i18n ("Quality (1-31):"), quality, formatlayout, 6, this); ADDPROPERTY (i18n ("Frame rate (Hz):"), framerate, formatlayout, 7, this); ADDPROPERTY (i18n ("Gop size:"), gopsize, formatlayout, 8, this); ADDPROPERTY (i18n ("Width (pixels):"), moviewidth, formatlayout, 9, this); ADDPROPERTY (i18n ("Height (pixels):"), movieheight, formatlayout, 10, this); label = new QLabel (i18n ("Allow access from:"), this); accesslist = new QTable (40, 1, this); accesslist->verticalHeader ()->hide (); accesslist->setLeftMargin (0); accesslist->setColumnWidth (0, 250); QWhatsThis::add (accesslist, i18n ("'Single IP' or 'start-IP end-IP' for IP ranges")); QHeader *header = accesslist->horizontalHeader (); header->setLabel (0, i18n ("Host/IP or IP Range")); QFrame *profileframe = new QFrame (this); QGridLayout *profileslayout = new QGridLayout (profileframe, 5, 2, 2); profile = new QLineEdit ("", profileframe); connect (profile, SIGNAL(textChanged (const QString &)), this, SLOT (slotTextChanged (const QString &))); profilelist = new QListBox (profileframe); for (int i = 0; i < (int) profiles.size (); i++) profilelist->insertItem (profiles[i]->name, i); connect (profilelist, SIGNAL (selected (int)), this, SLOT (slotIndexChanged (int))); connect (profilelist, SIGNAL (highlighted (int)), this, SLOT (slotItemHighlighted (int))); load = new QPushButton (i18n ("Load"), profileframe); save = new QPushButton (i18n ("Save"), profileframe); del = new QPushButton (i18n ("Delete"), profileframe); load->setEnabled (false); save->setEnabled (false); del->setEnabled (false); connect (load, SIGNAL (clicked ()), this, SLOT (slotLoad ())); connect (save, SIGNAL (clicked ()), this, SLOT (slotSave ())); connect (del, SIGNAL (clicked ()), this, SLOT (slotDelete ())); profileslayout->addWidget (profile, 0, 0); #if (QT_VERSION < 0x030200) profileslayout->addRowSpacing (4, 60); #else profileslayout->setRowSpacing (4, 60); #endif profileslayout->addMultiCellWidget (profilelist, 1, 4, 0, 0); profileslayout->addWidget (load, 1, 1); profileslayout->addWidget (save, 2, 1); profileslayout->addWidget (del, 3, 1); leftlayout->addWidget (profileframe); startbutton = new QPushButton (i18n ("Start"), this); serverled = new KLed (Qt::green, KLed::Off, KLed::Raised, KLed::Circular, this); feedled = new KLed (Qt::green, KLed::Off, KLed::Raised, KLed::Circular, this); ledlayout->addWidget (startbutton); ledlayout->addItem (new QSpacerItem (0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum)); ledlayout->addWidget (serverled); ledlayout->addWidget (feedled); leftlayout->addLayout (ledlayout); QFrame * line = new QFrame (this); line->setFrameShape (QFrame::HLine); leftlayout->addWidget (line); leftlayout->addWidget (label); leftlayout->addWidget (accesslist); leftlayout->addItem (new QSpacerItem (0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding)); layout->addLayout (leftlayout); line = new QFrame (this); line->setFrameShape (QFrame::VLine); layout->addWidget (line); layout->addLayout (formatlayout); layout->addItem (new QSpacerItem (0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding)); }
void Matrix::print() { QPrinter printer; printer.setColorMode (QPrinter::GrayScale); if (printer.setup()) { printer.setFullPage( TRUE ); QPainter p; if ( !p.begin(&printer ) ) return; // paint on printer QPaintDeviceMetrics metrics( p.device() ); int dpiy = metrics.logicalDpiY(); const int margin = (int) ( (1/2.54)*dpiy ); // 1 cm margins QHeader *hHeader = d_table->horizontalHeader(); QHeader *vHeader = d_table->verticalHeader(); int rows=d_table->numRows(); int cols=d_table->numCols(); int height=margin; int i,vertHeaderWidth=vHeader->width(); int right = margin + vertHeaderWidth; // print header p.setFont(QFont()); QRect br=p.boundingRect(br,Qt::AlignCenter, hHeader->label(0),-1,0); p.drawLine(right,height,right,height+br.height()); QRect tr(br); for (i=0;i<cols;i++) { int w=d_table->columnWidth (i); tr.setTopLeft(QPoint(right,height)); tr.setWidth(w); tr.setHeight(br.height()); p.drawText(tr,Qt::AlignCenter,hHeader->label(i),-1); right+=w; p.drawLine(right,height,right,height+tr.height()); if (right >= metrics.width()-2*margin ) break; } p.drawLine(margin + vertHeaderWidth, height, right-1, height);//first horizontal line height+=tr.height(); p.drawLine(margin,height,right-1,height); // print d_table values for (i=0;i<rows;i++) { right=margin; QString text=vHeader->label(i)+"\t"; tr=p.boundingRect(tr,Qt::AlignCenter,text,-1,0); p.drawLine(right,height,right,height+tr.height()); br.setTopLeft(QPoint(right,height)); br.setWidth(vertHeaderWidth); br.setHeight(tr.height()); p.drawText(br,Qt::AlignCenter,text,-1); right+=vertHeaderWidth; p.drawLine(right,height,right,height+tr.height()); for (int j=0;j<cols;j++) { int w=d_table->columnWidth (j); text=d_table->text(i,j)+"\t"; tr=p.boundingRect(tr,Qt::AlignCenter,text,-1,0); br.setTopLeft(QPoint(right,height)); br.setWidth(w); br.setHeight(tr.height()); p.drawText(br,Qt::AlignCenter,text,-1); right+=w; p.drawLine(right,height,right,height+tr.height()); if (right >= metrics.width()-2*margin ) break; } height+=br.height(); p.drawLine(margin,height,right-1,height); if (height >= metrics.height()-margin ) { printer.newPage(); height=margin; p.drawLine(margin,height,right,height); } } } }
TesterReport::TesterReport (QWidget *p) : QWidget (p) { QVBoxLayout *vbox = new QVBoxLayout(this); vbox->setMargin(5); vbox->setSpacing(5); tradeList = new QTable(0, 9, this); tradeList->setSelectionMode(QTable::Single); tradeList->setSorting(FALSE); QHeader *header = tradeList->horizontalHeader(); header->setLabel(0, tr("Type"), 40); header->setLabel(1, tr("Entry"), 90); header->setLabel(2, tr("Entry Price"), 60); header->setLabel(3, tr("Exit"), 90); header->setLabel(4, tr("Exit Price"), 60); header->setLabel(5, tr("Signal"), -1); header->setLabel(6, tr("Profit"), 60); header->setLabel(7, tr("Account"), -1); header->setLabel(8, tr("Vol"), 60); vbox->addWidget(tradeList); int loop; for (loop = 0; loop < 9; loop++) tradeList->setColumnReadOnly(loop, TRUE); // test summary QHBoxLayout *hbox = new QHBoxLayout(vbox); hbox->setSpacing(5); QVGroupBox *gbox = new QVGroupBox(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 QVGroupBox(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 QVGroupBox(tr("Loss 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("Profit "), gbox); summaryTotalLoseTrades = new QLabel(" ", gbox); label = new QLabel(tr("Average "), gbox); summaryAverageLose = new QLabel(" ", gbox); label = new QLabel(tr("Largest "), gbox); summaryLargestLose = new QLabel(" ", gbox); label = new QLabel(tr("Long Trades "), gbox); summaryLoseLongTrades = new QLabel(" ", gbox); label = new QLabel(tr("Short Trades "), gbox); summaryLoseShortTrades = new QLabel(" ", gbox); }
/* * Constructs a isiTapResults as 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. */ isiTapResults::isiTapResults( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { QRect rc; QHeader *header; bExitPossible=false; if ( !name ) setName( "isiTapResults" ); PushButtonOK = new QPushButton( this, "PushButtonOK" ); PushButtonOK->setGeometry( QRect( 183, 310, 75, 23 ) ); PushButtonOK->setFocusPolicy( QPushButton::NoFocus ); PushButtonOK->setDefault( TRUE ); // PushButtonOK->setMaximumSize(75,23); PushButtonCANCEL = new QPushButton( this, "PushButtonCANCEL" ); PushButtonCANCEL->setGeometry( QRect( 290, 310, 75, 23 ) ); PushButtonCANCEL->setFocusPolicy( QPushButton::NoFocus ); PushButtonCANCEL->hide(); PushButtonOK->hide(); // PushButtonCANCEL->setMaximumSize(75,23); connect( PushButtonOK, SIGNAL( clicked() ), this, SLOT(PushButtonOK_clicked()) ); connect( PushButtonCANCEL, SIGNAL( clicked() ), this, SLOT(PushButtonCANCEL_clicked()) ); Layout1 = new QVBoxLayout( this, 0, 6, "Layout1"); IDC_CHAN = new QTable( this, "IDC_CHAN" ); IDC_CHAN->setGeometry( QRect( 12, 12, 538, 112 ) ); IDC_CHAN->setNumRows( 0 ); IDC_CHAN->setNumCols( 5 ); IDC_CHAN->setSelectionMode( QTable::SingleRow ); IDC_CHAN->verticalHeader()->hide(); IDC_CHAN->setLeftMargin(0); header = IDC_CHAN->horizontalHeader(); // GetTextRectangle(header,"99:99:99 99/99/9999", rc); header->setLabel( 0, QObject::tr( "Station" ), 75 ); header->setLabel( 1, QObject::tr( "Channel" ), 75 ); header->setLabel( 2, QObject::tr( "SpS" ), 75 ); header->setLabel( 3, QObject::tr( "Tbeg" ), 75 ); header->setLabel( 4, QObject::tr( "Tend" ), 75 ); header->adjustHeaderSize(); adjustTableColumnWidth(); Layout1->addWidget(IDC_CHAN); outputLog = new QLabel( this, "outputLog" ); outputLog->setGeometry( QRect( 12, 130, 538, 112 ) ); Layout1->addWidget(outputLog); // outputLog->setReadOnly( TRUE ); progressBar1 = new QProgressBar( this, "progressBar1" ); progressBar1->setGeometry( QRect( 10, 260, 540, 22 ) ); Layout1->addWidget(progressBar1); Layout1->addWidget(outputLog); QGridLayout *gridLayout1 = new QGridLayout( Layout1, 1, 0, 5); // Layout1->addItem(gridLayout1); gridLayout1->addWidget(PushButtonOK,0,3); gridLayout1->addWidget(PushButtonCANCEL, 0, 4); languageChange(); resize( QSize(556, 354).expandedTo(minimumSizeHint()) ); // outputLog->adjust(); clearWState( WState_Polished ); StartGettingData(this); }
bool Matrix::eventFilter(QObject *object, QEvent *e) { QHeader *hheader = d_table->horizontalHeader(); QHeader *vheader = d_table->verticalHeader(); if (object == (QObject*)hheader) switch(e->type()) { case QEvent::MouseButtonDblClick: { const QMouseEvent *me = (const QMouseEvent *)e; selectedCol = hheader->sectionAt (me->pos().x()+hheader->offset()); return TRUE; } case QEvent::MouseButtonPress: { const QMouseEvent *me = (const QMouseEvent *)e; int col = hheader->sectionAt (me->pos().x() + hheader->offset()); if (me->button() == QMouseEvent::RightButton && !d_table->isColumnSelected(col,true)) { selectedCol=col; d_table->clearSelection(); d_table->selectColumn(selectedCol); d_table->setCurrentCell (0, selectedCol); } if (me->button() == QMouseEvent::LeftButton) { LeftButton=TRUE; if (me->state ()==Qt::ControlButton) { int current=d_table->currentSelection(); QTableSelection sel=d_table->selection(current); if (sel.topRow() != 0 || sel.bottomRow() != (d_table->numRows() - 1)) //select only full columns d_table->removeSelection(sel); } else d_table->clearSelection (TRUE); selectedCol=hheader->sectionAt (me->pos().x()+hheader->offset()); lastSelectedCol=selectedCol; d_table->selectColumn (selectedCol); d_table->setCurrentCell (0, selectedCol); } return TRUE; } case QEvent::MouseMove: { if(LeftButton) { const QMouseEvent *me = (const QMouseEvent *)e; selectedCol=hheader->sectionAt (me->pos().x() + hheader->offset()); if(selectedCol != lastSelectedCol) {// This means that we are in the next column if(d_table->isColumnSelected(selectedCol,TRUE)) {//Since this column is selected, deselect it d_table->removeSelection(QTableSelection (0,lastSelectedCol,d_table->numRows()-1,lastSelectedCol)); } else d_table->selectColumn (selectedCol); } lastSelectedCol=selectedCol; d_table->setCurrentCell (0, selectedCol); } return TRUE; } case QEvent::MouseButtonRelease: { LeftButton=FALSE; return TRUE; } default: ; } else if (e->type() == QEvent::MouseButtonPress && object == (QObject*)vheader) { const QMouseEvent *me = (const QMouseEvent *)e; int offset = vheader->offset(); int row = vheader->sectionAt(me->pos().y()+offset); if (me->button() == QMouseEvent::RightButton && !d_table->isRowSelected(row,true)) { d_table->clearSelection(); d_table->selectRow (row); d_table->setCurrentCell (row,0); } } else if (e->type()==QEvent::ContextMenu && object == titleBar) { emit showTitleBarMenu(); ((QContextMenuEvent*)e)->accept(); return true; } return QObject::eventFilter(object, e); }