LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Blogs
User Name
Password

Notices


Old

GUI Programming: QT4 Event Preeption Part 2-B (temp)

Posted 05-02-2012 at 08:38 PM by rainbowsally

Here's the code to run the examples and create a subclass of QApplication customized for our event preeption test. (See part 2-A)

file: src/utils.h
Code:
// utils.h

#ifndef utils_h
#define utils_h

#include <QObject>

// See explanation in utils.cpp
int lq_hash32(const char* name);

// See explanation in utils.cpp
typedef struct 
{
  int hashid; // computed once
  const
...
Member
Posted in Uncategorized
Views 755 Comments 0 rainbowsally is offline
Old

GUI Programming: QT4 Event Preeption Part 2-A (temp)

Posted 05-02-2012 at 08:32 PM by rainbowsally
Updated 05-04-2012 at 11:33 AM by rainbowsally (QA check failed ;-))

[Corrected hash algorithm to return -1 for null string (aka "") input. May 4, 2012]

Today's features
  • conditional compilation (OLD_SCHOOL vs. ?)
  • discovery of a potential recursion problem in preemptive event handling (QTextEdit)

This example is complicated enough to be but actually is not quite ready for prime time, but I do want to point out the advantage of creating hash values for speeding up text searches in tables of data. See the utils.cpp implementation...
Member
Posted in Uncategorized
Views 11339 Comments 2 rainbowsally is offline
Old

GUI Programming: Exposing the main event loop (Subclassing QApplication)

Posted 05-02-2012 at 06:23 AM by rainbowsally
Updated 05-02-2012 at 06:25 AM by rainbowsally

GUI Programming: Exposing the main event loop (Subclassing QApplication)

Today's features
  • a QTextEdit in 4 lines of code.
  • subclassing QApplication to view ALL objects and events as they are processed.
  • how to preempt events in QT

It looks like this is about the only way to actually preempt messages in QT4.

This is NOT the same as installEventFilter() which is simple and useful for many things but runs too late in a series of dispatches to preempt or change...
Member
Posted in Uncategorized
Views 1020 Comments 0 rainbowsally is offline
Old

QT4 Property dump example. (simple terminal app)

Posted 04-30-2012 at 02:24 AM by rainbowsally

This code just prints out the properties (and where they come from) for one widget. You can see the dump around the middle of this blog entry.

A full blown version would require a LOT of includes and libs and a way to replace a "ClassName" string in the file with the actual class we want to dump. (See "%s" in three places below.)

file: src/qt4-props.cpp
Code:
// file: qt4-props.cpp - lists all properties for (in this case)
// a
...
Member
Posted in Uncategorized
Views 888 Comments 0 rainbowsally is offline
Old

QT4 GUI testing and experiments (including sub-attaq and tooltips)

Posted 04-29-2012 at 12:43 AM by rainbowsally
Updated 08-06-2014 at 10:17 AM by rainbowsally (stuff like what? stuff like missing xml files happens (clarification))

Sorta back on track after some false starts and tweekage on the mc2 makfile creator...

Here's a few things that might be interesting that I cooked up while testing mc2 on QT examples and demos.

If nothing else you might be interested to see that *.pro files are NOT required to compile these things (there are some download links below).

------------------

If you want it, here's a utility to create a new ui file from scratch that will open...
Member
Posted in Uncategorized
Views 910 Comments 0 rainbowsally is offline

  



All times are GMT -5. The time now is 03:05 AM.

Main Menu
Advertisement
Advertisement
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
Open Source Consulting | Domain Registration