Welcome! Log In Create A New Profile

Advanced

Assignemnt 3....a question

Posted by BlaXpydo 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
Assignemnt 3....a question
September 28, 2010 11:23AM
OK, so I remove the line

app.setQuitOnLastWindowClosed(false);

from the question (its question 2), and my program still executes as normal. Why would that be?

_______________________________________
Don't be different...be the one making a difference
avatar Re: Assignemnt 3....a question
September 28, 2010 11:37AM
Let me guess, as usual.

Your app doesn't quit when you close your last window. However, your window does close quite happily. So to all appearances the app is still busy in the background?

That's probably a stupid guess, but something like
>> ps -aux

would probably be enough to eliminate the possibility (the nice way)

(The horrible way would be to keep firing up instances of the app until you've used up all your memory. Take the crash as proof that there's something occupying RAM...)
Re: Assignemnt 3....a question
September 28, 2010 11:53AM
Well, this might seems strange...but what do you mean by ..ps -aux?

And another problem, i'm trying to make my first dialog's cancel button work, bit to no avail. Any advice?

_______________________________________
Don't be different...be the one making a difference
avatar Re: Assignemnt 3....a question
September 28, 2010 01:16PM
smile
Advice is something you'd have to ask someone else for. Me? I can offer wild guesses, and that's about it.

Sorry about the ps -aux.
That's Linux for "p...roces..s" - with a switch to ia show "a"ll of them.

In Windows that'd be CTRL+ALT+DEL?

It's an easy theory to test, then, but its main virtue is that it might just annoy someone knowledgeable into setting things straight.

At the moment I don't have any wild guesses to offer about cancel buttons. Go through the basics, I suppose. Does the SIGNAL from the button-press connect to a SLOT that does what you want it to do? ... etc etc. ie. Pretend for a moment that you must've got that part of it wrong, and "prove yourself wrong". If you fail to do so, you might just have got it right -- and so will have a more interesting and infuriating error to dig out.
avatar Re: Assignemnt 3....a question
September 28, 2010 01:40PM
CTRL+ALT+DEL will get you to the login screen on Windows. From there you can access the Task Manager that shows you the currently running processes.

If you wish to get to the Task Manager directly without going through the login screen step, you can type the sequence CTRL+SHIFT+ESC
avatar Re: Assignemnt 3....a question
September 28, 2010 01:48PM
Thanks. I've written that on a post-it, and stuck it on the screen of the Windows machine.

I seem to remember KDE gave you GUI access to "kill" with that key sequence. Or was it just CTRL+ESC. Quite handy. The cursor would turn into a little skull-and-crossbones, just to warn you.
Re: Assignemnt 3....a question
September 29, 2010 04:53PM
Hi

Are there anyone here doing COS2144 at unisa for the second semester and are currently working on assignment 03 or are there anyone that know QT4 very well.

I like to know how to enable and disable an menu item.

QAction* myLogin::addChoice(QString name, QString text,bool stat) {
QAction* retval = new QAction(text,this);
retval->setObjectName(name);

if (name == "fileEdit" || name == "fileChange"winking smiley {
actionGroup->addAction(retval)->setDisabled(stat);
} else
actionGroup->addAction(retval);
}
return retval;
}

So I can disable it but how can I enable it. I hope somebody can help me.
avatar Re: Assignemnt 3....a question
September 29, 2010 07:30PM
Language: C++ (QT)
ActionName->setEnabled(true); ActionName->setEnabled(false);
Re: Assignemnt 3....a question
September 29, 2010 07:38PM
It don't want to work can u give me example code plz
avatar Re: Assignemnt 3....a question
September 29, 2010 08:07PM
OK if you were using dot notation you'd have

Object.function(arg1).function(arg2)

That evals to Object.AnotherObject.function(arg2) ? That looks OK? I think so.

Right, but then the offer of help you got there from t0xic should be just the business? Just fit it to the syntax you already have there.

actionGroup->addAction(retval)->setEnabled(stat);

If that doesn't work, maybe there's a problem with chaining the pointer member arrows together like that for some reason in this particular case?
Re: Assignemnt 3....a question
September 29, 2010 08:28PM
Can u give me some other example on that topic then I can modify it. I cannot enable it.,
avatar Re: Assignemnt 3....a question
September 29, 2010 08:39PM
If you want to be able to do something with your QActions sometime in the future, there are two options.

You need to hang on to the pointer addresses. Your addChoice function returns the address of the newly-created QAction object. You just need to store it somewhere so you can manipulate it sometime in the future.

or

An alternative is to recall the correct QAction by using it's objectName. Remeber the Composite Pattern?; that QActionGroup is a QObject and QObject has a template function called findChild that you can

eg.

Language: C++ (QT)
void myLogin::setActionEnabled(QString const &actionName, bool enabled) { QAction *action = actionGroup->findChild<QAction *>(actionName); if (action != 0) { action->setEnabled(enabled); } }
Re: Assignemnt 3....a question
September 29, 2010 09:02PM
kul! I'm gonna try it now then I let you know are u on skype (my skype name : julantino) if you are invite me.
Re: Assignemnt 3....a question
September 29, 2010 09:25PM
tx robanaurochs it works I got another question for u. How can I set the window::flags of an widget::WindowFlags(), I want to make my widget Modal if it popsup.
Anonymous User
Re: Assignemnt 3....a question
September 30, 2010 07:07AM
Language: C++ (QT)
yourWidget->setWindowModality(Qt::WindowModal);

...should do the trick.
Re: Assignemnt 3....a question
September 30, 2010 07:57AM
Tx phyzmatix for that I got an MainWindow from that window I open widgets if I put in that modal code I can still access the main window with out closing the widget I opened. So do anyone know how to solve that problem?
Anonymous User
Re: Assignemnt 3....a question
September 30, 2010 10:24AM
Could you post some code so that we can see what you are actually doing?
avatar Re: Assignemnt 3....a question
September 30, 2010 11:33AM
There are three types of modality that a window can have:

enum Qt::WindowModality
This enum specifies the behavior of a modal window. A modal window is one that blocks input to other windows. Note that windows that are children of a modal window are not blocked.

The values are:

Constant                Value        Description
Qt::NonModal            0            The window is not modal and does not block input to other windows.
Qt::WindowModal         1            The window is modal to a single window hierarchy and blocks input to its parent window, all grandparent windows, and all siblings of its parent and grandparent windows.
Qt::ApplicationModal	2            The window is modal to the application and blocks input to all windows.

To solve your problem, either make sure that you've set the parent/child heirarchy properly and use Qt:: WindowModal, or, alternatively, use Qt:: ApplicationModal.
Re: Assignemnt 3....a question
September 30, 2010 02:36PM
tx this Modal thing works I didnt know there was a thing like WindowModal Qt got alot of enum's thats why I missed it on Qt Assistant. Now I must change my code again because I solved it by hiding the mainwindow when the widget popup (login window/widget) and if the user cancel/login the mainwindow reappear.
Sorry, only registered users may post in this forum.

Click here to login