| 1 |
#include "picprop_p.h" |
| 2 |
#include "picprop_p.moc" |
| 3 |
|
| 4 |
#include <qframe.h> |
| 5 |
#include <qhbox.h> |
| 6 |
#include <qlabel.h> |
| 7 |
#include <qlayout.h> |
| 8 |
#include <qpushbutton.h> |
| 9 |
#include <qslider.h> |
| 10 |
|
| 11 |
/* |
| 12 |
* Constructs a PicPropDialog which is a child of 'parent', with the |
| 13 |
* name 'name' and widget flags set to 'f' |
| 14 |
* |
| 15 |
* The dialog will by default be modeless, unless you set 'modal' to |
| 16 |
* TRUE to construct a modal dialog. |
| 17 |
*/ |
| 18 |
PicPropDialog::PicPropDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) |
| 19 |
: QDialog( parent, name, modal, fl ) |
| 20 |
{ |
| 21 |
if ( !name ) |
| 22 |
setName( "PicPropDialog" ); |
| 23 |
|
| 24 |
setCaption( tr( "Picture Properties" ) ); |
| 25 |
#if QT_VERSION > 220 |
| 26 |
setSizeGripEnabled( TRUE ); |
| 27 |
#endif |
| 28 |
//setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, sizePolicy().hasHeightForWidth() ) ); |
| 29 |
//setMouseTracking( TRUE ); |
| 30 |
|
| 31 |
QVBoxLayout* vb = new QVBoxLayout( this, 5 ); |
| 32 |
|
| 33 |
QFrame* pFrame = new QFrame( this ); |
| 34 |
pFrame->setFrameShadow( QFrame::Raised ); |
| 35 |
//pFrame->setFrameShadow( QFrame::Sunken ); |
| 36 |
//pFrame->setFrameShape( QFrame::Box ); |
| 37 |
pFrame->setFrameShape( QFrame::WinPanel ); |
| 38 |
|
| 39 |
vb->addWidget( pFrame ); |
| 40 |
|
| 41 |
QGridLayout* gl = new QGridLayout( pFrame, 1, 1 ); |
| 42 |
gl->setMargin( 10 ); |
| 43 |
gl->setSpacing( 5 ); |
| 44 |
|
| 45 |
for (unsigned i = 0; i < PROP_LAST; i++) { |
| 46 |
m_pSlider[i] = new QSlider( -128, 127, 16, 0, QSlider::Horizontal, pFrame ); |
| 47 |
m_pSlider[i]->setTickmarks( QSlider::Right ); |
| 48 |
m_pSlider[i]->setMinimumWidth( 150 ); |
| 49 |
m_pSlider[i]->setValue( -128 ); |
| 50 |
m_pLabel[i] = new QLabel( "", pFrame ); |
| 51 |
m_pLabel[i]->setMinimumWidth( 110 ); |
| 52 |
gl->addWidget( m_pSlider[i], i, 0 ); |
| 53 |
gl->addWidget( m_pLabel[i], i, 1 ); |
| 54 |
} |
| 55 |
|
| 56 |
QHBoxLayout* hb = new QHBoxLayout( vb ); |
| 57 |
hb->addStretch( 1 ); |
| 58 |
QPushButton* pButton = new QPushButton( tr( "&Ok" ), this ); |
| 59 |
pButton->setDefault( TRUE ); |
| 60 |
hb->addWidget( pButton ); |
| 61 |
hb->addStretch( 1 ); |
| 62 |
|
| 63 |
// signals and slots connections |
| 64 |
connect( pButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); |
| 65 |
} |