mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 10:22:55 +00:00
take alternative sequence into account in QKeySequence::count() and QKeySequence::isEmpty()
code that assumes that if QKeySequence::count() returns non-zero or QKeySequence::isEmpty() returns false and the first keys is zero may choke but a key sequence with alternative only (the second key) is absolutely valid now Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
47f8d408ba
commit
9d5183127c
1 changed files with 9 additions and 6 deletions
|
@ -793,11 +793,14 @@ QKeySequence::~QKeySequence()
|
|||
*/
|
||||
int QKeySequence::count() const
|
||||
{
|
||||
if (!key1)
|
||||
return 0;
|
||||
if (!key2)
|
||||
return 1;
|
||||
return 2;
|
||||
int result = 0;
|
||||
if (key1 > 0) {
|
||||
result++;
|
||||
}
|
||||
if (key2 > 0) {
|
||||
result++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
@ -807,7 +810,7 @@ int QKeySequence::count() const
|
|||
*/
|
||||
bool QKeySequence::isEmpty() const
|
||||
{
|
||||
return (key1 <= 0);
|
||||
return (key1 <= 0 && key2 <= 0);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue