Re: Help with QT shortcuts?
you are connecting the wrong slot of the wrong object. Infact everything is wrong.
try this.
Code:
QObject::connect(aShortCut,
SIGNAL(activated
()), aButton,
SLOT(animateClick
()));
by the way,, the "&aButton" should be working as auto shortcut
Re: Help with QT shortcuts?
Mmmkay. I changed the QObject line like you said and it still isn't working.
Not sure what you mean by "should be working as auto shortcut."
I'm a newbie to QT, so I apologize ahead of time for my lack of knowledge.
Re: Help with QT shortcuts?
read the documentation of QShortCut and QAbstractButton, you just might be doing a little mistake here and there....
Can you post a minimal compilable program reproducing the problem?
Re: Help with QT shortcuts?
Re: Help with QT shortcuts?
hi,
as totem said,
Code:
aButton->setShortcut(Qt::Key_A)
is the easiest way
Bala
Re: Help with QT shortcuts?
Okay, so I changed the lines to this:
Code:
aButton->setShortcut(Qt::Key_A);
// QObject::connect(aShortCut, SIGNAL(activated()), aButton, SLOT(animateClick()));
(I commented out that last line....I think I was supposed to do that now that I'm using the aButton->setShortcut. Still issue though. It compiles and runs, but the aButton isn't clicked when I press the letter a on my keyboard.
Any other ideas?
Re: Help with QT shortcuts?
are you connecting to any signals at all?
Re: Help with QT shortcuts?
I was before with that last line that I commented out...
Re: Help with QT shortcuts?
You need to provide a minimal compilable example reproducing the problem.
Re: Help with QT shortcuts?
I'd rather not just post it on here, as it is a school project. Perhaps I can private message it to you? Which files would you need to be able to see the problem?
Re: Help with QT shortcuts?
Anyone else have any ideas?
I need to finish this soon. =/
I feel like I ALMOST have it...like I'm off by one tiny error or something.
Re: Help with QT shortcuts?
Working ..............
QPushButton *aButton=new QPushButton("&aButton", this);
QShortcut *aShortCut = new QShortcut(QKeySequence(Qt::Key_A), aButton);
QObject::connect(aShortCut, SIGNAL(activated()), aButton, SLOT(animateClick()));