You are not logged in.

Dear visitor, welcome to KDE-Forum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

soul_rebel

Beginner

  • "soul_rebel" started this thread

Posts: 21

Location: Germany

  • Send private message

1

Tuesday, May 17th 2005, 1:12am

proper resize of preferences dlg

i have an app with a preferences dialog. since i used the example code from kdevelop the preferences dlg itself is hardcoded (no ui file) and every page is its own ui file. the problem is that the preferences dlg doesnt resize to fit the pages content.... here's my code:

Source code

1
2
3
4
5
6
7
8
9
QFrame *frame;
    frame = addPage(i18n("Main"), i18n("General Settings"), IconLoader.loadIcon((QString)"../../beastie.xpm", KIcon::NoGroup));
   
    m_pageOne = new KPortsPrefPageOne(frame);

    frame = addPage(i18n("Appearance"), i18n("Display-Settings"),IconLoader.loadIcon((QString)"looknfeel", KIcon::NoGroup));
    frame->setFrameRect(frame->contentsRect());

    m_pageTwo = new KPortsPrefPageTwo(frame);


i've tried stuff like setsizepolicy, but it wont help. only thing that has worked yet is setfixedsize but thats not a real solution!
thanks for help
"As long as there is private property and while money is the standard of all things, I do not think that a nation can be governed either justly or happily..." - Raphael Hythloday in Utopia by Thomas More, 15th Century

jacek

Trainee

Posts: 105

Location: Warsaw, Poland

Occupation: Student

  • Send private message

2

Tuesday, May 17th 2005, 1:30am

RE: proper resize of preferences dlg

Quoted

Originally posted by soul_rebel
the problem is that the preferences dlg doesnt resize to fit the pages content...

Have you set any layouts for that dialog?

anda_skoa

Professional

Posts: 1,273

Location: Graz, Austria

Occupation: Software Developer

  • Send private message

3

Tuesday, May 17th 2005, 4:53pm

You could check if frame has a layout after it is returned by addPage and if yes, add your widget to the layout and if not, create a layout and add your widget.

However you should also have a look at the KConfigXT tutorial
http://developer.kde.org/documentation/t…/kconfigxt.html

Cheers,
_
Qt/KDE Developer
Debian User

soul_rebel

Beginner

  • "soul_rebel" started this thread

Posts: 21

Location: Germany

  • Send private message

4

Wednesday, May 18th 2005, 1:44pm

thanks first of all
i tried setting a layout but without a result.... i inserted

Source code

1
2
QBoxLayout layout(this, QBoxLayout::LeftToRight);
layout.addWidget(frame);

into the constructor...

Quoted

You could check if frame has a layout after it is returned by addPage
how would i do that? i know fopr sure that the two dialogs inserted have align in grid set by kdevelopdesigner...
"As long as there is private property and while money is the standard of all things, I do not think that a nation can be governed either justly or happily..." - Raphael Hythloday in Utopia by Thomas More, 15th Century

anda_skoa

Professional

Posts: 1,273

Location: Graz, Austria

Occupation: Software Developer

  • Send private message

5

Wednesday, May 18th 2005, 8:24pm

Quoted

Originally posted by soul_rebel
thanks first of all
i tried setting a layout but without a result.... i inserted

Source code

1
2
QBoxLayout layout(this, QBoxLayout::LeftToRight);
layout.addWidget(frame);

into the constructor...

If you have it exactly like this the layout will be deleted at constructor end (created on stack)

Quoted


Quoted

You could check if frame has a layout after it is returned by addPage
how would i do that? i know fopr sure that the two dialogs inserted have align in grid set by kdevelopdesigner...


Source code

1
if (frame->layout() != 0)


Cheers,
_
Qt/KDE Developer
Debian User

soul_rebel

Beginner

  • "soul_rebel" started this thread

Posts: 21

Location: Germany

  • Send private message

6

Thursday, May 19th 2005, 5:41pm

i cant get it to work.... :(
whatever i try either nothing happens or i get sigsev....
if someone knew the exact lines of code i would have to insert, i would be really grateful...
thanks
"As long as there is private property and while money is the standard of all things, I do not think that a nation can be governed either justly or happily..." - Raphael Hythloday in Utopia by Thomas More, 15th Century