/*! What do you think it does? */ void QHeader::init( int n ) { if ( !hSplitCur ) hSplitCur = new QCursor( QBitmap( hsplit_width, hsplit_height, hsplit_bits, TRUE), QBitmap( hsplit_width, hsplit_height, hsplitm_bits, TRUE) ); if ( !vSplitCur ) vSplitCur = new QCursor( QBitmap( vsplit_width, vsplit_height, vsplit_bits, TRUE), QBitmap( vsplit_width, vsplit_height, vsplitm_bits, TRUE) ); state = Idle; data = new QHeaderData; data->sizes.resize(n+1); data->labels.resize(n+1); data->a2l.resize(n+1); data->l2a.resize(n+1); data->clicks.resize(n+1); data->resize.resize(n+1); for ( int i = 0; i < n ; i ++ ) { data->labels[i] = 0; data->sizes[i] = 88; data->a2l[i] = i; data->l2a[i] = i; } data->clicks.fill( TRUE ); data->resize.fill( TRUE ); data->move = TRUE; setFrameStyle( QFrame::NoFrame ); if ( orient == Horizontal ) { setCellWidth( 0 ); setCellHeight( height() ); setNumCols( n ); setNumRows( 1 ); } else { setCellWidth( width() ); setCellHeight( 0 ); setNumCols( 1 ); setNumRows( n ); } handleIdx = 0; //################ data->labels[n] = 0; data->sizes[n] = 0; data->a2l[n] = 0; data->l2a[n] = 0; //############# setMouseTracking( TRUE ); trackingIsOn = FALSE; }
DiffView::DiffView( KConfig& cfg, bool withlinenos, bool withmarker, QWidget *parent, const char *name ) : QtTableView(parent, name, Qt::WNoAutoErase) , linenos(withlinenos) , marker(withmarker) , textwidth(0) , partner(0) , partConfig(cfg) { setNumRows(0); setNumCols( 1 + (withlinenos?1:0) + (withmarker?1:0) ); setTableFlags( Tbl_autoVScrollBar|Tbl_autoHScrollBar| Tbl_smoothVScrolling ); setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); setBackgroundRole( QPalette::Base ); configChanged(); QFontMetrics fm(font()); setCellHeight(fm.lineSpacing()); setCellWidth(0); const KConfigGroup group(&partConfig, "General"); m_tabWidth = group.readEntry("TabWidth", 8); items.setAutoDelete(true); connect(CervisiaSettings::self(), SIGNAL(configChanged()), this, SLOT(configChanged())); }
MyGridView() { setNumRows( ::numRows ); setNumCols( ::numCols ); setCellWidth( fontMetrics().width( QString("%1 / %2").arg(numRows()).arg(numCols()))); setCellHeight( 2*fontMetrics().lineSpacing() ); setCaption( tr( "Qt Example - This is a grid with 100 x 100 cells" ) ); }
bool QGridView::qt_property( int id, int f, QVariant* v) { switch ( id - staticMetaObject()->propertyOffset() ) { case 0: switch( f ) { case 0: setNumRows(v->asInt()); break; case 1: *v = QVariant( this->numRows() ); break; case 3: case 4: case 5: break; default: return FALSE; } break; case 1: switch( f ) { case 0: setNumCols(v->asInt()); break; case 1: *v = QVariant( this->numCols() ); break; case 3: case 4: case 5: break; default: return FALSE; } break; case 2: switch( f ) { case 0: setCellWidth(v->asInt()); break; case 1: *v = QVariant( this->cellWidth() ); break; case 3: case 4: case 5: break; default: return FALSE; } break; case 3: switch( f ) { case 0: setCellHeight(v->asInt()); break; case 1: *v = QVariant( this->cellHeight() ); break; case 3: case 4: case 5: break; default: return FALSE; } break; default: return QScrollView::qt_property( id, f, v ); } return TRUE; }
FingerList::FingerList(TabTrack *p, QWidget *parent, const char *name) : Q3GridView(parent, name) { parm = p; setVScrollBarMode(Auto); setHScrollBarMode(AlwaysOff); setFrameStyle(Panel | Sunken); setBackgroundMode(Qt::PaletteBase); setFocusPolicy(Qt::StrongFocus); num = 0; curSel = -1; oldCol = 0; oldRow = 0; setCellWidth(ICONCHORD); setCellHeight(ICONCHORD); setMinimumSize(ICONCHORD + 2, ICONCHORD + 2); resize(width(), 3 * ICONCHORD + 2); fretNumberFont = new QFont(font()); if (fretNumberFont->pointSize() == -1) { fretNumberFont->setPixelSize((int) ((double) fretNumberFont->pixelSize() * FRET_NUMBER_FONT_FACTOR)); } else { fretNumberFont->setPointSizeFloat(fretNumberFont->pointSizeFloat() * FRET_NUMBER_FONT_FACTOR); } repaint(); }
FingerList::FingerList(TabTrack *p, QWidget *parent, const char *name): #if QT_VERSION < 300 QTableView(parent, name) #else QGridView(parent, name) #endif { parm = p; #if QT_VERSION < 300 setTableFlags(Tbl_autoVScrollBar | Tbl_smoothScrolling); #else setVScrollBarMode(QScrollView::Auto); #endif setFrameStyle(Panel | Sunken); setBackgroundMode(PaletteBase); setFocusPolicy(StrongFocus); num = 0; curSel = -1; oldCol = 0; oldRow = 0; setCellWidth(ICONCHORD); setCellHeight(ICONCHORD); setMinimumSize(ICONCHORD + 2, ICONCHORD + 2); resize(width(), 3 * ICONCHORD + 2); repaint(); }
void KDateTable::viewportResizeEvent(QResizeEvent * e) { QGridView::viewportResizeEvent(e); setCellWidth(viewport()->width()/7); setCellHeight(viewport()->height()/7); }
void kMyMoneyDateTbl::viewportResizeEvent(QResizeEvent * e) { if (e) QGridView::viewportResizeEvent(e); setCellWidth(viewport()->width()/m_colCount); setCellHeight(viewport()->height()/m_rowCount); }
void QHeader::setOrientation( Orientation orientation ) { if (orient==orientation) return; orient = orientation; int n = count(); if ( orient == Horizontal ) { setCellWidth( 0 ); setCellHeight( height() ); setNumCols( n ); setNumRows( 1 ); } else { setCellWidth( width() ); setCellHeight( 0 ); setNumCols( 1 ); setNumRows( n ); } updateTableSize(); repaint(); }
KUserTable::KUserTable(QWidget *parent, const char *name) : KRowTable(SelectRow, parent, name) { QString pixdir = kapp->kde_datadir() + QString("/kuser/pics/"); pmUser = new QPixmap(pixdir + "user.xpm"); setCellHeight( max( fontMetrics().lineSpacing(), pmUser->height()) ); setNumCols( 2 ); setAutoUpdate(TRUE); current = -1; sort = -1; }
//================================================================== void KCharSelectTable::resizeEvent( QResizeEvent * e ) { const int new_w = (e->size().width() - 2*(margin()+frameWidth())) / numCols(); const int new_h = (e->size().height() - 2*(margin()+frameWidth())) / numRows(); if( new_w != cellWidth()) setCellWidth( new_w ); if( new_h != cellHeight()) setCellHeight( new_h ); setToolTips(); }
CustomPalette::CustomPalette( QWidget *parent ) : QGridView( parent ) { parent_widget = parent; setCellWidth( 9 ); setCellHeight( 9 ); setNumRows( 12 ); setNumCols( 19 ); cell_border_color = QColor( 0, 0, 0 ); k_toon = ( Ktoon * )( parent_widget -> parentWidget() ); clear(); }
void KBBGraphic::setSize( int w, int h ) { if ((w != numCols) || (h != numRows)) { delete graphicBoard; graphicBoard = new RectOnArray( w, h ); graphicBoard->fill( OUTERBBG ); setNumCols( w ); setNumRows( h ); setCellWidth( CELLW ); setCellHeight( CELLH ); minW = cellW * numRows; minH = cellH * numCols; emit(sizeChanged()); } }
void PiecesTable::resizeEvent(QResizeEvent *e) { /* * null if we faked it after the config dialog ran to * regenerate everything */ if ( e ) QTableView::resizeEvent(e); setCellWidth(contentsRect().width()/ numCols()); setCellHeight(contentsRect().height() / numRows()); /* update the image and calculate border*/ slotCustomImage( _image ); }
KFinderWin::KFinderWin( KFinder *_finder ) : QTableView( _finder ) { node = 0L; itemList.setAutoDelete( FALSE ); finder = _finder; setNumCols( finder->buttonList.count()!=0 ? finder->buttonList.count() : 1 ); setNumRows( 0 ); setCellHeight( CELL_HEIGHT ); setTableFlags( Tbl_autoScrollBars | /* Tbl_clipCellPainting | */ Tbl_smoothScrolling ); dropZone = new KDNDDropZone( this , DndURL ); connect( dropZone, SIGNAL( dropAction( KDNDDropZone *) ), this, SLOT( slotDropEvent( KDNDDropZone *) ) ); }
//================================================================== KCharSelectTable::KCharSelectTable( QWidget *parent, const char *name, const QString &_font, const QChar &_chr, int _tableNum ) : QGridView( parent, name ), vFont( _font ), vChr( _chr ), vTableNum( _tableNum ), vPos( 0, 0 ), focusItem( _chr ), focusPos( 0, 0 ), d(0) { setBackgroundColor( colorGroup().base() ); setCellWidth( 20 ); setCellHeight( 25 ); setNumCols( 32 ); setNumRows( 8 ); repaintContents( false ); setToolTips(); setFocusPolicy( QWidget::StrongFocus ); setBackgroundMode( QWidget::NoBackground ); }
void PiecesTable::resizeEvent(TQResizeEvent *e) { QtTableView::resizeEvent(e); // set font TQFont f = font(); if (height() > 50) f.setPixelSize(8); else if (height() > 40) f.setPixelSize(7); else if (height() > 24) f.setPixelSize(5); else f.setPixelSize(3); setFont(f); setCellWidth(contentsRect().width()/ numRows()); setCellHeight(contentsRect().height() / numCols()); }
int Q3GridView::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = Q3ScrollView::qt_metacall(_c, _id, _a); if (_id < 0) return _id; #ifndef QT_NO_PROPERTIES if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< int*>(_v) = numRows(); break; case 1: *reinterpret_cast< int*>(_v) = numCols(); break; case 2: *reinterpret_cast< int*>(_v) = cellWidth(); break; case 3: *reinterpret_cast< int*>(_v) = cellHeight(); break; } _id -= 4; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setNumRows(*reinterpret_cast< int*>(_v)); break; case 1: setNumCols(*reinterpret_cast< int*>(_v)); break; case 2: setCellWidth(*reinterpret_cast< int*>(_v)); break; case 3: setCellHeight(*reinterpret_cast< int*>(_v)); break; } _id -= 4; } else if (_c == QMetaObject::ResetProperty) { _id -= 4; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 4; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 4; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 4; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 4; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 4; } #endif // QT_NO_PROPERTIES return _id; }
MarkListTable::MarkListTable( QWidget * parent , const char * name ) : QTableView( parent, name ), sel(-1), drag(-1), items() { setFrameStyle( Panel | Sunken ); setTableFlags( Tbl_autoVScrollBar | Tbl_cutCellsV | Tbl_snapToVGrid | Tbl_clipCellPainting); setLineWidth( 1 ); setCellHeight( fontMetrics().lineSpacing()+4 ); setNumCols( 2 ); // setBackgroundColor( colorGroup().normal().light(120) ); pup = new QPopupMenu(0, "pup"); pup->insertItem( i18n("Mark current page"), this, SLOT(markSelected()) ); pup->insertItem( i18n("Mark all pages"), this, SLOT(markAll()) ); pup->insertItem( i18n("Mark even pages"), this, SLOT(markEven()) ); pup->insertItem( i18n("Mark odd pages"), this, SLOT(markOdd()) ); pup->insertItem( i18n("Toggle page marks"), this, SLOT(toggleMarks()) ); pup->insertItem( i18n("Remove page marks"), this, SLOT(removeMarks()) ); // items.setAutoDelete( TRUE ); selectColor = QColor( black ); selectTextColor = QColor( white ); }
KBBGraphic::KBBGraphic( QPixmap **p, QWidget* parent, const char* name ) : QWidget( parent, name ) { int i; curRow = curCol = 0; setFocusPolicy( NoFocus ); setBackgroundColor( gray ); setCellWidth( CELLW ); // set width of cell in pixels setCellHeight( CELLH ); // set height of cell in pixels setMouseTracking( FALSE ); pix = p; if (pix == NULL) pixScaled = NULL; else { pixScaled = new QPixmap * [NROFTYPES]; for (i = 0; i < NROFTYPES; i++) { pixScaled[i] = new QPixmap; } } graphicBoard = NULL; drawBuffer = NULL; }
void KBBGraphic::resizeEvent( QResizeEvent* e ) { int w = QWidget::width(); int h = QWidget::height(); int wNew, hNew; // debug("%d %d %d %d", w, h, minW, minH ); if (w > minW) { wNew = w / numC(); } else { wNew = CELLW; } if (h > minH) { hNew = h / numR(); } else { hNew = CELLH; } if (pix != NULL) scalePixmaps( wNew, hNew ); setCellWidth( wNew ); setCellHeight( hNew ); if (drawBuffer != NULL) delete drawBuffer; drawBuffer = new QPixmap( cellW * numRows, cellH * numCols ); }
void KBBGraphic::resizeEvent( QResizeEvent* ) { int w = QWidget::width(); int h = QWidget::height(); int wNew, hNew; // kbDebug() << w << " " << h << " " << minW << " " << minH << endl; if (w > minW) { wNew = w / numC(); } else { wNew = CELLW; } if (h > minH) { hNew = h / numR(); } else { hNew = CELLH; } if (pix != NULL) scalePixmaps( wNew, hNew ); setCellWidth( wNew ); setCellHeight( hNew ); delete drawBuffer; drawBuffer = new QPixmap( cellW * numRows, cellH * numCols ); }
void KColorCells::resizeEvent( TQResizeEvent * ) { setCellWidth( width() / numCols() ); setCellHeight( height() / numRows() ); }
void KDateInternalMonthPicker::viewportResizeEvent(QResizeEvent*) { setCellWidth(width()/3); setCellHeight(height()/4); }
void DiffView::setFont(const QFont &font) { QtTableView::setFont(font); QFontMetrics fm(font); setCellHeight(fm.lineSpacing()); }