[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bindings
Subject:    Re: [Kde-bindings] Qt, Qyoto buttons work intermediately
From:       IBBoard <ibboard () gmail ! com>
Date:       2010-02-20 14:52:13
Message-ID: 4B7FF71D.50204 () gmail ! com
[Download RAW message or body]

On 20/02/10 14:30, linuxoidoz@yahoo.com.au wrote:
> Sorry, I've probably confused you by windows, they're not actually \
> windows but rather QStackedWidget pages. Here's my example: 
> I'm writing an application to convert video, audio and image files. So in \
> its basic form I want to have a main general class with a StackedWidget \
> and separate classes which will draw different gui widgets on different \
> StackedWidget pages. So 
> 1. I have a MainWindow class - main class with QStackedWidget
> 2. class StartWindow - start page with 3 button: Video, Audio, Image
> 3. class VideoWindow - video converter page
> 3. class AudioWindow - audio converter page
> 3. class ImageWindow - image converter page
> 
> But I don't want to draw 4 pages (because only one will be displayed at a \
> time and also to minimise the code). So I only create the start page and \
> a second page based on what button has been pressed on the start page. \
> And then just switch between the two by changing the StackedWidget page \
> index. And when you return to the start page, the other page is \
> destroyed. Confused? Well, what I can't figure out is, for example,  
> 1. How can I add a Video page to the StackedWidget from StartWindow if \
> the StackedWidget itself is declared in MainWindow? How do you pass the \
> page reference in the signal/slot which will do the page switch? 2. Or \
> even simpler, how can I change text in the status bar from another page \
> if the status bar is declared in MainWindow? How do you pass a reference \
> to the main window status bar in a signal declaration? How can you pass \
> that variable if it only takes types?


That sounds more like programming issues in general than Qt issues.

1) sounds like a bit of a bad idea in general - more sensible would be
to have the StartWindow fire an event, have the MainWindow subscribe to
the event, and then have a method in the MainWindow add the page when
the event occurs. That way the pages are only concerned with their own
stuff, not with other things.

2) Probably the same - keep things separated so that the page doesn't
know about the construction of the main window, but use events so that
the main window can do whatever it needs to.

Tight coupling, like it sounds like you have, is generally going to
cause you problems in the long run :)
_______________________________________________
Kde-bindings mailing list
Kde-bindings@kde.org
https://mail.kde.org/mailman/listinfo/kde-bindings


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic