In the ease of using it. What would you say if double was not
pre-baked by Qt in the form of a virtual method mouseDoubleClickEvent ?
I don't agree with your statment.
A single left and right clicks as well as left double click became a standard use of mouse button long ago.
Since practically every GUI application uses some or all of those it makes sense to have them in a GUI library.
But multi clicks are not a standard practice, therefore, I would not excpect it to be built in Qt.
A library, a framework is supposed to help get things done simpler, no ?
Yes.
And Qt is great at doing that.
Qt covers lots of frequently used tasks in GUI and non GUI applications alike, but it can't cover ALL wishes of everyone, you have to agree about that - so where should one draw the line on what to implement and what not?
Surely you have to agree that the degree of how much a feature is used is a good mesure to decide that.
I wish MouseEvent had a "multiClickCount" or something of that meaning.
Well, I wish Qt had many other features...
But that would take all the fun out of coding...
I guess it would not have cost that much as the time comparison is already
executed for double click... I thought... and then read the source. OK this seems
to be heavily system dependent.
Qt offers you all the tools to do that easely, and it is NOT system dependent, since QTimer/QTime is not system dependent nor is QMouseEvent.
But QTextEdit has some thing of this kind in its source...
Thats one way to go about it, (reading in to Qt source) but the problem is really simple... just few lines of code...
{
clickTimer.start(m_timeout);
}
{
clickTimer.stop();
m_clickCounter++;
}
//the slot to be executed when clickTimer timesout
void MyWidget::multiClickSlot()
{
switch(m_clickCounter)
{
case 3: //do something
break;
case 4: //do somthing else
}
}
MyWidget::mouseReleaseEvent ( QMouseEvent * event )
{
clickTimer.start(m_timeout);
}
MyWidget::mousePressEvent( QMouseEvent * event )
{
clickTimer.stop();
m_clickCounter++;
}
//the slot to be executed when clickTimer timesout
void MyWidget::multiClickSlot()
{
switch(m_clickCounter)
{
case 3: //do something
break;
case 4: //do somthing else
}
}
To copy to clipboard, switch view to plain text mode
Or something similar...
Bookmarks