head 1.2; access; symbols; locks; strict; comment @// @; 1.2 date 2005.07.01.19.49.07; author cworth; state Exp; branches; next 1.1; commitid 3eec42c59e334567; 1.1 date 2005.01.25.20.24.22; author cworth; state Exp; branches; next ; desc @@ 1.2 log @ From 2005-01-25 Zack Rusin : * .cvsignore: * controlwidgetbase.ui: * mainwindow.cpp: * mainwindow.h: * qcairo.cpp: * qcairo.h: * qcairo.pro: * qcairowidget.cpp: * qcairowidget.h: * qkapow.cpp: * qkapow.h: 1) I created a QCairoWidget which has a virtual void cairoPaint(cairo_t *) method which essentially replaces the QWidget::paintEvent. It's done essentially to enable people to just take the widget, stick it in their app and just use Cairo (either duble-buffered or not). 2) Instead of the old demo code it uses now kapow. It's a little bit more attractive and nicely shows how to use QCairoWidget. @ text @#include "mainwindow.h" #include "controlwidgetbase.h" #include "qkapow.h" #include #include #include #include #include #include #include #include #include #include MainWindow::MainWindow() : QMainWindow( 0 ) { createGUI(); createActions(); } void MainWindow::createGUI() { QScrollView *view = new QScrollView( this ); m_qcairo = new QKapow( view ); view->addChild( m_qcairo ); setCentralWidget( view ); QDockWindow *dockWindow = new QDockWindow( QDockWindow::InDock, this, "controldock" ); dockWindow->setResizeEnabled( true ); m_control = new ControlWidgetBase( dockWindow, "controlwidget" ); dockWindow->setWidget( m_control ); addDockWindow( dockWindow, Qt::DockLeft ); m_control->m_width->setMinValue( 100 ); m_control->m_height->setMinValue( 100 ); m_control->m_width->setMaxValue( 1000 ); m_control->m_height->setMaxValue( 1000 ); m_control->m_textEdit->setText( "sample" ); m_control->m_width->setValue( m_qcairo->width() ); m_control->m_height->setValue( m_qcairo->height() ); m_control->m_dbCB->setChecked( m_qcairo->doubleBuffered() ); connect( m_control->m_updateBtn, SIGNAL(clicked()), SLOT(updateWidget()) ); } void MainWindow::createActions() { QPopupMenu *file = new QPopupMenu( this ); menuBar()->insertItem( "&File", file ); file->insertItem( "&Quit", qApp, SLOT(quit()) ); } void MainWindow::updateWidget() { m_qcairo->setText( m_control->m_textEdit->text() ); m_qcairo->setDoubleBuffered( m_control->m_dbCB->isChecked() ); m_qcairo->resize( m_control->m_width->value(), m_control->m_height->value() ); m_qcairo->update(); } @ 1.1 log @Initial commit of qcairo demo as contributed by Zack Rusin @ text @d4 1 a4 1 #include "qcairo.h" d7 2 d10 1 a10 1 #include d26 4 a29 2 m_qcairo = new QCairo( this ); setCentralWidget( m_qcairo ); d38 9 a46 3 m_control->m_baseSpin->setValue( m_qcairo->baseLength() ); m_control->m_lineSpin->setValue( m_qcairo->lineWidth() ); m_control->m_dbCB->setChecked( m_qcairo->doubleBuffer() ); d62 4 a65 3 m_qcairo->setBaseLength( m_control->m_baseSpin->value() ); m_qcairo->setLineWidth( m_control->m_lineSpin->value() ); m_qcairo->setDoubleBuffer( m_control->m_dbCB->isChecked() ); @