fixes up an error that occured when joypad events were not being passed when a dialog window that had the main configuration window as its parent was opened, removed dependence on an undocumented function
git-svn-id: svn://svn.code.sf.net/p/qjoypad/code/trunk@123 c05e91a0-76c8-4ec0-b377-ef19ce7cc080
This commit is contained in:
committed by
virtuoussin13
parent
899b878dc8
commit
03f4297446
@ -48,7 +48,7 @@ LayoutEdit::LayoutEdit( LayoutManager* l ): QWidget(NULL) {
|
|||||||
{
|
{
|
||||||
it.next();
|
it.next();
|
||||||
names[i] = it.value()->getName();
|
names[i] = it.value()->getName();
|
||||||
connect(this, SIGNAL(focusChange(bool)), it.value(), SLOT(focusChange(bool)));
|
connect(this, SIGNAL(focusStateChanged(bool)), it.value(), SLOT(focusChange(bool)));
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
} while (0);
|
} while (0);
|
||||||
@ -93,6 +93,8 @@ LayoutEdit::LayoutEdit( LayoutManager* l ): QWidget(NULL) {
|
|||||||
connect( quit, SIGNAL( clicked() ), qApp, SLOT(quit()));
|
connect( quit, SIGNAL( clicked() ), qApp, SLOT(quit()));
|
||||||
h->addWidget(quit);
|
h->addWidget(quit);
|
||||||
LMain->addLayout(h);
|
LMain->addLayout(h);
|
||||||
|
connect(qApp, SIGNAL(focusChanged ( QWidget * , QWidget * ) ), this,
|
||||||
|
SLOT(appFocusChanged(QWidget *, QWidget *)));
|
||||||
this->show();
|
this->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,21 +159,23 @@ void LayoutEdit::updateJoypadWidgets() {
|
|||||||
} while (0);
|
} while (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayoutEdit::windowActivationChange( bool oldActive ) {
|
|
||||||
emit focusChange(oldActive);
|
|
||||||
if (oldActive) return;
|
|
||||||
//whenever the window becomes active, release all pressed buttons! This way
|
|
||||||
//you don't get any presses without releases to confuse things.
|
|
||||||
QHashIterator<int, JoyPad*> it( available );
|
|
||||||
while (it.hasNext())
|
|
||||||
{
|
|
||||||
debug_mesg("iterating and releasing\n");
|
|
||||||
it.next();
|
|
||||||
it.value()->release();
|
|
||||||
}
|
|
||||||
debug_mesg("done releasing!\n");
|
|
||||||
}
|
|
||||||
void LayoutEdit::closeEvent(QCloseEvent *event) {
|
void LayoutEdit::closeEvent(QCloseEvent *event) {
|
||||||
lm->leWindowClosed();
|
lm->leWindowClosed();
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LayoutEdit::appFocusChanged(QWidget *old, QWidget *now) {
|
||||||
|
if(now!=NULL && old==NULL) {
|
||||||
|
emit focusStateChanged(false);
|
||||||
|
} else if(old!=NULL && now==NULL) {
|
||||||
|
emit focusStateChanged(true);
|
||||||
|
QHashIterator<int, JoyPad*> it( available );
|
||||||
|
while (it.hasNext())
|
||||||
|
{
|
||||||
|
debug_mesg("iterating and releasing\n");
|
||||||
|
it.next();
|
||||||
|
it.value()->release();
|
||||||
|
}
|
||||||
|
debug_mesg("done releasing!\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -25,13 +25,13 @@ class LayoutEdit : public QWidget {
|
|||||||
void updateLayoutList();
|
void updateLayoutList();
|
||||||
void updateJoypadWidgets();
|
void updateJoypadWidgets();
|
||||||
signals:
|
signals:
|
||||||
void focusChange(bool);
|
void focusStateChanged(bool);
|
||||||
|
public slots:
|
||||||
|
void appFocusChanged(QWidget *old, QWidget *now);
|
||||||
protected:
|
protected:
|
||||||
//the layout manager this represents
|
//the layout manager this represents
|
||||||
LayoutManager* lm;
|
LayoutManager* lm;
|
||||||
virtual void closeEvent(QCloseEvent *event);
|
virtual void closeEvent(QCloseEvent *event);
|
||||||
//find out when the window is activated.
|
|
||||||
virtual void windowActivationChange( bool oldActive );
|
|
||||||
//parts of the dialog:
|
//parts of the dialog:
|
||||||
QVBoxLayout *LMain;
|
QVBoxLayout *LMain;
|
||||||
QStackedWidget *PadStack;
|
QStackedWidget *PadStack;
|
||||||
|
Reference in New Issue
Block a user