Hello,
I'm just new in C++ and now we have in school very difficult lessons which we need to make.
Here's one i just don't get working. We have a picture with lines, the lines must change color when i press the left or right mousebutton.
rightnow i've the code
{
Qt::MouseButtons pressed;
pressed = event->button();
if (pressed.button == Qt::LeftButton)
{penKleur = Qt::green;}
else
if (pressed.button ==Qt::RightButton)
{penKleur = Qt::yellow;}
}
void Hoofdscherm::mousePressEvent(QMouseEvent *event)
{
Qt::MouseButtons pressed;
pressed = event->button();
if (pressed.button == Qt::LeftButton)
{penKleur = Qt::green;}
else
if (pressed.button ==Qt::RightButton)
{penKleur = Qt::yellow;}
}
To copy to clipboard, switch view to plain text mode
it's not going to work. i know you can make it with switch but we didn't have that in school yet so it must be different.
Bookmarks