[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice-devel
Subject: Help needed again.
From: p.stirnweiss_koffice () bluewin ! ch
Date: 2004-08-30 19:25:45
Message-ID: 412EB53F0001C1C3 () mssbzhb-int ! msg ! bluewin ! ch
[Download RAW message or body]
Hello,
Sorry to bother you again with my newbies questions, but I am really stuck
(again).
I would like to do a little test bed program to test the widgets I am doing.
I tried with KDevelop simple KDE app, the thing compile but there are loads
of warnings regarding iconload folder, then the app crashes (that was yesterday
evening). This evening I am trying with Qt Designer but the results are even
worse.
Is there a simple way to write a very small app I can use to tests these
widgets? I am not familiar at all with automake and stuff.
Pierre
["koDecoTab.h" (text/x-chdr)]
/****************************************************************************
** Form interface generated from reading ui file './ui/koDecoTabBase.ui'
**
** Created: Sat Aug 28 22:42:29 2004
** by: The User Interface Compiler ($Id: qt/main.cpp 3.3.2 edited Nov 24 \
13:47 $)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
/* Be carefull, due to short knowledge of Qt Designer (or short commings of Qt \
Designer), this file has been modified by hand and renamed (remove the base bit of \
the name). Should you want to rearrange the ui files, make sure you incorporate these \
changes. I will try to comment the lines I modified. */
#ifndef DECORATIONTAB_H
#define DECORATIONTAB_H
#include <qvariant.h>
#include <qpixmap.h>
#include <qwidget.h>
//#include <kiconloader.h> //uic warning
#include <kdialog.h> //uic warning
#include <klocale.h>
//#include <koGlobal.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QSpacerItem;
class QGroupBox;
class QLabel;
class KColorButton;
class QSpinBox;
class QButtonGroup;
class KPushButton;
class koDecoTab : public QWidget //uic warning: renamed class and members
{
Q_OBJECT
public:
koDecoTab( QWidget* parent = 0, const char* name = 0 );
~koDecoTab();
signals: //uic warning : added signals and slots
void textColorChanged(const QColor &newColor);
void backgroundColorChanged(const QColor &newColor);
void shadowChanged(const QColor &shadowColor, double shadowDistanceX, double \
shadowDistanceY);
public slots:
void setSelection( QColor &textColor, QColor &backgroundColor, QColor \
&shadowColor, double shadowDistanceX, double shadowDistanceY );
protected: //uic warning : change public/private
QGroupBox* colorGroupBox;
QLabel* textColorLabel;
QLabel* backgroundColorLabel;
KColorButton* backgroundKColorButton;
KColorButton* textKColorButton;
QGroupBox* shadowGroupBox;
QLabel* shadowDistanceLabel;
KColorButton* shadowKColorButton;
QSpinBox* shadowDistanceSpinBox;
QLabel* shadowColorLabel;
QButtonGroup* shadowDirectionButtonGroup;
KPushButton* luShadowKPushButton;
KPushButton* uShadowKPushButton;
KPushButton* ruShadowKPushButton;
KPushButton* rShadowKPushButton;
KPushButton* rbShadowKPushButton;
KPushButton* bShadowKPushButton;
KPushButton* lbShadowKPushButton;
KPushButton* lShadowKPushButton;
QVBoxLayout* decorationTabLayout;
QGridLayout* colorGroupBoxLayout;
QGridLayout* shadowGroupBoxLayout;
QSpacerItem* spacer1;
QSpacerItem* spacer2;
QGridLayout* shadowDirectionButtonGroupLayout;
QColor newShadowColor;
int shadowDirection;
double shadowDistanceX;
double shadowDistanceY;
int shadowDistance;
protected slots: //uic warnings: added slots
void textColorChangedSlot(const QColor &newColor );
void backgroundColorChangedSlot(const QColor &newColor );
void shadowChangedSlot();
/* uic warning : remove the languageChange slot*/
private: //uic warning: removed pixmaps.
enum ShadowDirections{
SD_LEFT_UP ,
SD_UP ,
SD_RIGHT_UP ,
SD_RIGHT ,
SD_RIGHT_BOTTOM ,
SD_BOTTOM ,
SD_LEFT_BOTTOM ,
SD_LEFT
};
};
#endif // DECORATIONTAB_H
["koDecoTab.cpp" (text/x-c++src)]
/****************************************************************************
** Form implementation generated from reading ui file './ui/koDecoTabBase.ui'
**
** Created: Sat Aug 28 22:43:08 2004
** by: The User Interface Compiler ($Id: qt/main.cpp 3.3.2 edited Nov 24 \
13:47 $)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
/* Be carefull, due to short knowledge of Qt Designer (or short commings of Qt \
Designer), this file has been modified by hand and renamed (remove the base bit of \
the name). Should you want to rearrange the ui files, make sure you incorporate these \
changes. I will try to comment the lines I modified. */
#include "koDecoTab.h"
#include <qvariant.h>
#include <qpushbutton.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <kcolorbutton.h>
#include <qspinbox.h>
#include <qbuttongroup.h>
#include <kpushbutton.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
/*
* Constructs a Form1 as a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*/
koDecoTab::koDecoTab( QWidget* parent, const char* name ) //uic warning : name \
changed. also in destructor : QWidget( parent, name )
{
decorationTabLayout = new QVBoxLayout( this, KDialog::marginHint(), \
KDialog::spacingHint(), "decorationTabLayout"); //uic warning: margin and spacing
///////////////////// Colors ///////////////////
colorGroupBox = new QGroupBox( i18n( "Colors" ), this, "colorGroupBox" ); //uic \
warning : added text colorGroupBox->setColumnLayout(0, Qt::Vertical );
colorGroupBox->layout()->setSpacing( KDialog::spacingHint() ); //uic warning
colorGroupBox->layout()->setMargin( KDialog::marginHint() ); //uic warning
colorGroupBoxLayout = new QGridLayout( colorGroupBox->layout() );
colorGroupBoxLayout->setAlignment( Qt::AlignTop );
textColorLabel = new QLabel( i18n( "Text Color :") ,colorGroupBox, \
"textColorLabel" ); //uic warning : added text
colorGroupBoxLayout->addWidget( textColorLabel, 0, 0 );
backgroundColorLabel = new QLabel( i18n( "Background Color :"), colorGroupBox, \
"backgroundColorLabel" ); //uic warning : added text
colorGroupBoxLayout->addWidget( backgroundColorLabel, 1, 0 );
textKColorButton = new KColorButton( colorGroupBox, "textKColorButton" );
colorGroupBoxLayout->addWidget( textKColorButton, 0, 1 );
backgroundKColorButton = new KColorButton( colorGroupBox, \
"backgroundKColorButton" ); //uic warning: changed creation order
colorGroupBoxLayout->addWidget( backgroundKColorButton, 1, 1 );
decorationTabLayout->addWidget( colorGroupBox );
//////////////////////// Shadows ////////////////////////
shadowGroupBox = new QGroupBox( i18n( "Text Shadows"), this, "shadowGroupBox" ); \
//uic warning : added text shadowGroupBox->setSizePolicy( QSizePolicy( \
(QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, \
shadowGroupBox->sizePolicy().hasHeightForWidth() ) ); \
shadowGroupBox->setColumnLayout(0, Qt::Vertical ); \
shadowGroupBox->layout()->setSpacing( KDialog::spacingHint() ); //uic warning \
shadowGroupBox->layout()->setMargin( KDialog::marginHint() ); //uic warning \
shadowGroupBoxLayout = new QGridLayout( shadowGroupBox->layout() ); \
shadowGroupBoxLayout->setAlignment( Qt::AlignTop );
shadowColorLabel = new QLabel( i18n("Shadow Color :"), shadowGroupBox, \
"shadowColorLabel" ); //uic warning : added text shadowGroupBoxLayout->addWidget( \
shadowColorLabel, 0, 0 );
shadowKColorButton = new KColorButton( shadowGroupBox, "shadowKColorButton" );
shadowGroupBoxLayout->addWidget( shadowKColorButton, 0, 1 );
shadowDistanceLabel = new QLabel( i18n( "Shadow Distance :"), shadowGroupBox, \
"shadowDistanceLabel" ); //uic warning : added text \
shadowGroupBoxLayout->addWidget( shadowDistanceLabel, 1, 0 );
shadowDistanceSpinBox = new QSpinBox( shadowGroupBox, "shadowDistanceSpinBox" );
shadowDistanceSpinBox->setMaxValue( 20 );
shadowGroupBoxLayout->addWidget( shadowDistanceSpinBox, 1, 1 );
spacer1 = new QSpacerItem( 30, 20, QSizePolicy::Expanding, QSizePolicy::Minimum \
); shadowGroupBoxLayout->addItem( spacer1, 0, 2 );
spacer2 = new QSpacerItem( 30, 21, QSizePolicy::Expanding, QSizePolicy::Minimum \
); shadowGroupBoxLayout->addItem( spacer2, 1, 2 );
shadowDirectionButtonGroup = new QButtonGroup( shadowGroupBox, \
"shadowDirectionButtonGroup" ); shadowDirectionButtonGroup->setSizePolicy( \
QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, \
shadowDirectionButtonGroup->sizePolicy().hasHeightForWidth() ) ); \
shadowDirectionButtonGroup->setFrameShape( QButtonGroup::NoFrame ); \
shadowDirectionButtonGroup->setExclusive( TRUE ); \
shadowDirectionButtonGroup->setColumnLayout(0, Qt::Vertical ); \
shadowDirectionButtonGroup->layout()->setSpacing( KDialog::spacingHint() ); //uic \
warning shadowDirectionButtonGroup->layout()->setMargin( 0 );
shadowDirectionButtonGroupLayout = new QGridLayout( \
shadowDirectionButtonGroup->layout() ); \
shadowDirectionButtonGroupLayout->setAlignment( Qt::AlignTop );
luShadowKPushButton = new KPushButton( "lu", shadowDirectionButtonGroup, \
"luShadowKPushButton" ); // luShadowKPushButton->setPixmap( BarIcon( "shadowLU" ) \
); //uic warning : externalised pixmap luShadowKPushButton->setToggleButton( TRUE );
luShadowKPushButton->setOn( TRUE );
shadowDirectionButtonGroupLayout->addWidget( luShadowKPushButton, 0, 0 );
uShadowKPushButton = new KPushButton( "u", shadowDirectionButtonGroup, \
"uShadowKPushButton" ); // uShadowKPushButton->setPixmap( BarIcon( "shadowU" ) ); \
//uic warning : externalised pixmap uShadowKPushButton->setToggleButton( TRUE );
shadowDirectionButtonGroupLayout->addWidget( uShadowKPushButton, 0, 1 );
ruShadowKPushButton = new KPushButton( "ru", shadowDirectionButtonGroup, \
"ruShadowKPushButton" ); // ruShadowKPushButton->setPixmap( BarIcon( "shadowRU" ) \
); //uic warning : externalised pixmap ruShadowKPushButton->setToggleButton( TRUE );
shadowDirectionButtonGroupLayout->addWidget( ruShadowKPushButton, 0, 2 );
rShadowKPushButton = new KPushButton( "r", shadowDirectionButtonGroup, \
"rShadowKPushButton" ); // rShadowKPushButton->setPixmap( BarIcon( "shadowR" ) ); \
//uic warning : externalised pixmap rShadowKPushButton->setToggleButton( TRUE );
shadowDirectionButtonGroupLayout->addWidget( rShadowKPushButton, 1, 2 );
rbShadowKPushButton = new KPushButton( "rb", shadowDirectionButtonGroup, \
"rbShadowKPushButton" ); // rbShadowKPushButton->setPixmap( BarIcon( "shadowRB" ) \
); //uic warning : externalised pixmap rbShadowKPushButton->setToggleButton( TRUE );
shadowDirectionButtonGroupLayout->addWidget( rbShadowKPushButton, 2, 2 );
bShadowKPushButton = new KPushButton( "b", shadowDirectionButtonGroup, \
"bShadowKPushButton" ); // bShadowKPushButton->setPixmap( BarIcon( "shadowB" ) ); \
//uic warning : externalised pixmap bShadowKPushButton->setToggleButton( TRUE );
shadowDirectionButtonGroupLayout->addWidget( bShadowKPushButton, 2, 1 );
lbShadowKPushButton = new KPushButton( "lb", shadowDirectionButtonGroup, \
"lbShadowKPushButton" ); // lbShadowKPushButton->setPixmap( BarIcon( "shadowLB" ) \
); //uic warning : externalised pixmap lbShadowKPushButton->setToggleButton( TRUE );
shadowDirectionButtonGroupLayout->addWidget( lbShadowKPushButton, 2, 0 );
lShadowKPushButton = new KPushButton( "l", shadowDirectionButtonGroup, \
"lShadowKPushButton" ); // lShadowKPushButton->setPixmap( BarIcon( "shadowL" ) ); \
//uic warning : externalised pixmap lShadowKPushButton->setToggleButton( TRUE );
shadowDirectionButtonGroupLayout->addWidget( lShadowKPushButton, 1, 0 );
shadowGroupBoxLayout->addMultiCellWidget( shadowDirectionButtonGroup, 0, 1, 3, 3 \
); decorationTabLayout->addWidget( shadowGroupBox );
//uic warning : added connections removed buddies
connect( textKColorButton, SIGNAL( changed(const QColor &) ), this, SLOT( \
textColorChangedSlot(const QColor & )) ); connect( backgroundKColorButton, SIGNAL( \
changed(const QColor &) ), this, SLOT( backgroundColorChangedSlot(const QColor & )) \
); connect( shadowDirectionButtonGroup, SIGNAL( clicked( int ) ), this, SLOT( \
shadowChangedSlot() ) ); connect( shadowKColorButton, SIGNAL( changed(const QColor \
&) ), this, SLOT( shadowChangedSlot() ) ); connect( shadowDistanceSpinBox, SIGNAL( \
valueChanged( int ) ), this, SLOT( shadowChangedSlot() ) );
}
/*
* Destroys the object and frees any allocated resources
*/
koDecoTab::~koDecoTab()
{
// no need to delete child widgets, Qt does it all for us
}
void koDecoTab::textColorChangedSlot(const QColor &newColor )
{
emit textColorChanged( newColor );
}
void koDecoTab::backgroundColorChangedSlot(const QColor &newColor )
{
emit backgroundColorChanged( newColor );
}
void koDecoTab::shadowChangedSlot()
{
newShadowColor = shadowKColorButton->color();
shadowDirection = shadowDirectionButtonGroup->selectedId();
shadowDistance = shadowDistanceSpinBox->value();
switch ( shadowDirection )
{
case SD_LEFT_UP:
shadowDistanceX = - shadowDistance;
shadowDistanceY = - shadowDistance;
break;
case SD_UP:
shadowDistanceX = 0;
shadowDistanceY = - shadowDistance;
break;
case SD_RIGHT_UP:
shadowDistanceX = shadowDistance;
shadowDistanceY = - shadowDistance;
break;
case SD_RIGHT:
shadowDistanceX = shadowDistance;
shadowDistanceY = 0;
break;
case SD_RIGHT_BOTTOM:
shadowDistanceX = shadowDistance;
shadowDistanceY = shadowDistance;
break;
case SD_BOTTOM:
shadowDistanceX = 0;
shadowDistanceY = shadowDistance;
break;
case SD_LEFT_BOTTOM:
shadowDistanceX = - shadowDistance;
shadowDistanceY = shadowDistance;
break;
case SD_LEFT:
shadowDistanceX = - shadowDistance;
shadowDistanceY = 0;
break;
}
emit shadowChanged( newShadowColor, shadowDistanceX, shadowDistanceY );
}
void koDecoTab::setSelection ( QColor &textColor, QColor &backgroundColor, QColor \
&shadowColor, double shadowDistanceX, double shadowDistanceY ) {
textKColorButton->setColor( textColor );
backgroundKColorButton->setColor ( backgroundColor );
/* I do not know which one is best :
shadowDirection = SD_LEFT_UP;
if ( shadowDistanceX > 0 ) // right
if ( shadowDistanceY == 0 )
shadowDirection = SD_RIGHT;
else
shadowDirection = shadowDistanceY > 0 ? SD_RIGHT_BOTTOM : SD_RIGHT_UP;
else if ( shadowDistanceX == 0 ) // top/bottom
shadowDirection = shadowDistanceY > 0 ? SD_BOTTOM : SD_UP;
else // left
if ( shadowDistanceY == 0 )
shadowDirection = SD_LEFT;
else
shadowDirection = shadowDistanceY > 0 ? SD_LEFT_BOTTOM : SD_LEFT_UP;
*/
int dirx = shadowDistanceX = 0 ? 0 : shadowDistanceX / QABS( shadowDistanceX );
int diry = shadowDistanceY = 0 ? 0 : shadowDistanceY / QABS( shadowDistanceY );
switch ( dirx )
{
case -1:
switch ( diry )
{
case -1:
shadowDirection = SD_LEFT_UP;
break;
case 0:
shadowDirection = SD_LEFT;
break;
case 1:
shadowDirection = SD_LEFT_UP;
break;
}
break;
case 0:
switch ( diry )
{
case -1:
shadowDirection = SD_UP;
break;
case 0:
shadowDirection = SD_LEFT_UP; // this one does not matter, no shadows are \
displayed break;
case 1:
shadowDirection = SD_BOTTOM;
break;
}
break;
case 1:
switch ( diry )
{
case -1:
shadowDirection = SD_RIGHT_UP;
break;
case 0:
shadowDirection = SD_RIGHT;
break;
case 1:
shadowDirection = SD_RIGHT_BOTTOM;
break;
}
break;
}
shadowDirectionButtonGroup->setButton( shadowDirection );
shadowDistanceSpinBox->setValue( (int) QMAX( QABS(shadowDistanceX), \
QABS(shadowDistanceY) ) ); shadowKColorButton->setColor( shadowColor );
}
#include "koDecoTab.moc"
_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic