LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 11-22-2003, 01:49 AM   #1
LOUDSilence
Member
 
Registered: Oct 2003
Location: Sydney
Distribution: Red Hat 8
Posts: 77

Rep: Reputation: 15
Events In KDE


how would I get acces the the On Resize event in QT or KDE?

I am using KDevelop and GT Designer
 
Old 11-22-2003, 04:05 AM   #2
jinksys
Member
 
Registered: Aug 2003
Location: 63123
Distribution: OpenSuSE/Ubuntu
Posts: 418

Rep: Reputation: 31
Simple, in order for your class to use the event, you will need to declare the QT resizeEvent handler in the constructor, like below.

Code:
class Test : public QWidget
{
  Q_OBJECT 
  public:
    /** construtor */
    Test(QWidget* parent=0, const char *name=0);
    /** destructor */
    ~Test();
  protected:
  void resizeEvent(QResizeEvent*);
  
};
then, you'll need to define the event handler's function like below...

Code:
void Test::resizeEvent(QResizeEvent *e)
{
  resize(100,100);
 }
So, whenever you resize the Test window, it will automatically be resized back to 100,100!
 
Old 11-22-2003, 11:29 PM   #3
LOUDSilence
Member
 
Registered: Oct 2003
Location: Sydney
Distribution: Red Hat 8
Posts: 77

Original Poster
Rep: Reputation: 15
is
void resizeEvent(QResizeEvent*);

that actual name for it, if I change that it will not work? I was just wondering as you have not connected it in any way? (As in GTK)

can I still do this if i used QT desiner to make my gui?
 
Old 11-23-2003, 03:41 AM   #4
jinksys
Member
 
Registered: Aug 2003
Location: 63123
Distribution: OpenSuSE/Ubuntu
Posts: 418

Rep: Reputation: 31
yes, if you change it, it will not work. It is the method of QWidget that handles resize events and its prototype is,
Code:
void QWidget::resizeEvent ( QResizeEvent* )
Events are not connected as Slots/Signals are, they are connected by QT's internal mechanisms. Qt's main event loop (QApplication::exec()) fetches native window system events from the event queue, translates them into QEvents and sends the translated events to QObjects. Then, when the QObject, such as QWidget, receives the event it executes the appropriate event method. As far as QT Designer is concerned, you shouldn't have any problems with events.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
writing my own events bianchi Programming 0 11-28-2005 07:29 AM
events/0 spikes Moloko Debian 5 02-03-2005 09:08 AM
no sound events in my account in kde Abrocadabro Debian 2 01-28-2005 09:22 AM
acpi events? raven Linux - Laptop and Netbook 2 10-12-2003 03:23 PM
Binding keys to events in KDE Whosrodney Linux - Software 4 09-26-2003 07:03 PM


All times are GMT -5. The time now is 09:29 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration