Example #1
0
/*!
  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;
}
Example #2
0
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()));
}
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();
}
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;
}
Example #5
0
    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" ) );
    }
Example #6
0
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();
}
Example #7
0
void
KDateTable::viewportResizeEvent(QResizeEvent * e)
{
  QGridView::viewportResizeEvent(e);

  setCellWidth(viewport()->width()/7);
  setCellHeight(viewport()->height()/7);
}
Example #8
0
void
kMyMoneyDateTbl::viewportResizeEvent(QResizeEvent * e)
{
  if (e)
    QGridView::viewportResizeEvent(e);

  setCellWidth(viewport()->width()/m_colCount);
  setCellHeight(viewport()->height()/m_rowCount);
}
Example #9
0
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();
}
Example #10
0
//==================================================================
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();
}
Example #12
0
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());
    }
}
Example #13
0
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 );

}
Example #14
0
//==================================================================
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 );
}
Example #15
0
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());
}
Example #16
0
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;
}
Example #17
0
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;
}
Example #18
0
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 );
}
Example #19
0
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 );
}
Example #20
0
void KColorCells::resizeEvent( TQResizeEvent * )
{
	setCellWidth( width() / numCols() );
	setCellHeight( height() / numRows() );
}
Example #21
0
void
KDateInternalMonthPicker::viewportResizeEvent(QResizeEvent*)
{
  setCellWidth(width()/3);
  setCellHeight(height()/4);
}