Notices


Reply
Thread Tools
Venemo's Avatar
Posts: 1,290 | Thanked: 1,753 times | Joined on Aug 2009 @ Budapest, Hungary
#41
Originally Posted by mikhas View Post
http://doc.trolltech.com/4.6/qwidget.html#closeEvent

Reimplement this event handler to ignore the close event on a certain condition. Also see the example which explains why this can be useful.
Thanks!

I'll post the solution here, in case anyone else wants it. It bugs me though, that it can't be done without creating a derived class.

Code:
#ifndef UNCLOSEABLEMESSAGEBOX_H
#define UNCLOSEABLEMESSAGEBOX_H

#include <Qt>
#include <QtGui>
#include <QtCore>

class UncloseableMessageBox : public QMessageBox
{

public:

    UncloseableMessageBox(const QString& title, const QString& text, Icon icon, QWidget *parent = NULL) : QMessageBox(icon, title, text, QMessageBox::Ok, parent)
    {
        this->button(QMessageBox::Ok)->hide();
    }

    void closeEvent(QCloseEvent *event)
    {
        event->ignore();
    }

};

#endif // UNCLOSEABLEMESSAGEBOX_H
If anyone finds a mistake, I'd appreciate it if you tell me.
 

The Following User Says Thank You to Venemo For This Useful Post:
Posts: 148 | Thanked: 199 times | Joined on Nov 2009
#42
Originally Posted by Venemo View Post
Thanks!

I'll post the solution here, in case anyone else wants it. It bugs me though, that it can't be done without creating a derived class.
That's just how Qt rolls: signals here, but events there. There is nothing a signal couldn't do what an event can do (from my POV).
However, if you have a crappy signal and slot implementation (slow, preprocessor-based, no real namespace support, no compile-time checks, no flexible parameter binding, only QSignalMapper or private slots) then you try everything to get around it, at least when performance and correctness is important. Well, and turns out that this actually *is* important if you write frameworks or libraries.

That's why you have this seemingly arbitrary separation between signals and events in Qt, even though it makes no sense to the application developer (which would almost always prepare a signal over an event, simply because it is easier to use and more flexible).

You'll soon get used to the Qt mantra of deriving custom classes for every little feature though (I am not saying that this is a good habit).
 

The Following User Says Thank You to mikhas For This Useful Post:
Venemo's Avatar
Posts: 1,290 | Thanked: 1,753 times | Joined on Aug 2009 @ Budapest, Hungary
#43
Mikhas, you seem to know much about Qt.

Could you please view this thread?
It would be great if you could say something about that issue.
 
Posts: 148 | Thanked: 199 times | Joined on Nov 2009
#44
I only had a brief look at the example, it probably crashes because something else is closing your QDialog before you get to handle the dialog's response. But just looking at the code is not as helpful as simply running it through the debugger. So if you turn the code snippet into a compiling testcase (which still reproduces the crash) then I can help you.
 
Venemo's Avatar
Posts: 1,290 | Thanked: 1,753 times | Joined on Aug 2009 @ Budapest, Hungary
#45
Originally Posted by mikhas View Post
I only had a brief look at the example, it probably crashes because something else is closing your QDialog before you get to handle the dialog's response. But just looking at the code is not as helpful as simply running it through the debugger. So if you turn the code snippet into a compiling testcase (which still reproduces the crash) then I can help you.
The entire source of the application (with Qt creator project files and all) is there at another post.
 
sifo's Avatar
Posts: 1,359 | Thanked: 1,292 times | Joined on Oct 2011 @ Tartus.Syria
#46
Hello
guys im very very new to qt and development stuff so you got to excuse me...
ok so i have maemo SDK, scratchbox, and qt SDk installed on my ubuntu lucid ( 10.04 )
i created in qt-creator a hello-world app and it's directory contains :
-/qml/hellowrld/main.qml
-/qmlapplicationviewer/
--qmlapplicationviewer.cpp
--qmlapplicationviewer.h
--qmlapplicationviewer.pri
-helloworld.desktop
-helloworld.pro.user
-main.cpp
-helloworld.png
-helloworld.pro
-helloworld.svg

what steps i should do to compile that source and result a binary that i could send it to my N900 and run it
would really appreciate a short step by step guide

./sifo
__________________
[ N900-Crack ] [ The Purge ] [ New Smiles ] [ New icons ] [ ? ]
" Hey ! I've just met you and this is crazy, so install cssu maybe ? "
Please help out keeping Maemo.org alive, and consider donating.
https://www.facebook.com/ZoRk7

Last edited by sifo; 2012-10-25 at 18:35. Reason: typo
 
Copernicus's Avatar
Posts: 1,987 | Thanked: 7,692 times | Joined on Dec 2010 @ Dayton, Ohio
#47
Originally Posted by sifo View Post
what steps i should do to compile that source and result a binary that i could send it to my N900 and run it
would really appreciate a short step by step guide
I'm not so sure there's a perfectly short guide to doing it. I think the most important item is probably to get the Maemo Toolchain for your SDK, if you haven't already. You can do this by starting up the SDK Maintenance Tool, going to the Package Manager, and drilling down to Qt SDK -> Development Tools -> Maemo Toolchain.

(At least, this is how I'm doing it. I haven't updated my SDK in almost a year though, so things might have changed a bit.)

Once you've got the toolchain, you should be able to set up Maemo 5 as one of the targets for your project. (There's a "Projects" icon on the left side of my Qt Creator window that allows you to edit project targets.)

There's a scratchbox environment you can use to simulate a N900 for testing purposes, and a wizard to simplify installing apps onto a real N900. You can also just copy a binary on to your device and run it directly, if you prefer.

Probably the best resource for me is the Qt Maemo/Meego Support Page, which contains links to most of the Maemo-related documentation on their website.

So yeah, nothing extremely quick and easy to get you started, but once you've got all the bits and pieces in place, it's easy to build binaries and get them on to your device.
 

The Following 2 Users Say Thank You to Copernicus For This Useful Post:
Posts: 2,245 | Thanked: 4,003 times | Joined on Apr 2010 @ England
#48
Here's some pages I bookmarked in Firefox from when I setup my environment a couple of months ago.

http://wiki.maemo.org/Documentation/...-based_systems

http://wiki.maemo.org/Documentation/...own_the_SDK_UI

http://talk.maemo.org/showthread.php?t=68684&page=2

Qt "Build" will create files that are upload-able to extras.
This makes a source.changes, dsc and tar files for the autobuilder.

To create armel debs I move the files to scratchbox MyDocs directory and run in scratchbox armel targets...

Code:
dpkg-buildpackage -rfakeroot -sa
This makes a armel.deb, and armel sources.
I install the armel.deb to my N900 to test.

If the package works OK, I upload the file created by Qt "build" to autobuilder.

Remember if using this method to change your compat file to 5 as 7 will not work in scratchbox.
__________________
The stable-beast currently runs...
21.2011.38-1Smaemo8 (CSSU Stable)
2.6.28.10power53 (125-600Mhz SR VDD1&2)

Wiki Admin
sixwheeledbeast's wiki
Testing Squad Subscriber
- mcallerx - tenminutecore - FlopSwap - Qnotted - zzztop - Bander - Fight2048 -


Before posting or starting a thread please try this.
 

The Following 2 Users Say Thank You to sixwheeledbeast For This Useful Post:
qwazix's Avatar
Moderator | Posts: 2,621 | Thanked: 5,429 times | Joined on Jan 2010
#49
I usually prefer using madde, makes my life easier, and works as well.

Just install madde on N900, add maemo toolchain from the QtSDK update tool, go to options -> linux devices -> device configuration on QtCreator and let the wizard guide you.
__________________
Proud coding competition 2012 winner: ρcam
My other apps: speedcrunch N9 N900 Jolla contactlaunch timenow

Nemo UX blog: Grog
My website: qwazix.com
My job: oob
 

The Following 2 Users Say Thank You to qwazix For This Useful Post:
sifo's Avatar
Posts: 1,359 | Thanked: 1,292 times | Joined on Oct 2011 @ Tartus.Syria
#50
Thank you all for your replies
And here come the story how can i copy stuff from / to scratchbox (MyDocs) ?

./sifo
__________________
[ N900-Crack ] [ The Purge ] [ New Smiles ] [ New icons ] [ ? ]
" Hey ! I've just met you and this is crazy, so install cssu maybe ? "
Please help out keeping Maemo.org alive, and consider donating.
https://www.facebook.com/ZoRk7
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 01:45.