-1

In my application I have rectangle which I can resize (manually implemented mouse events for resizing). My problem is that I can resize my rectangle in any size. How can I implement function which forbids to resize under 100x100 pixels. In other words I want function which sets minimum size for rectangle so user can't resize that rectangle under 100x100 pixels. If needed I will provide parts of mine code, but for now I need idea or pseudo code.

Alen
  • 1,750
  • 7
  • 31
  • 62

1 Answers1

0

If you have already written the code, which resizes your rectangle, all you need to add is something like this:

QRect r = oldRect();
switch (border)
{
    case Left:
        r.setLeft(newLeftPos());
        if (r.width() < minimumWidth())
            r.setLeft(r.right() - minimumWidth());
    break;

    ...

}
draw(r);
Amartel
  • 4,248
  • 2
  • 15
  • 21