Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Widget Resizable now support multiple types of resize #1081

Merged
merged 1 commit into from
Jul 16, 2022
Merged

Widget Resizable now support multiple types of resize #1081

merged 1 commit into from
Jul 16, 2022

Conversation

NIKEA-SOFT
Copy link
Contributor

@NIKEA-SOFT NIKEA-SOFT commented Jul 1, 2022

Now we can support several types of "resizable" at the same time
Example:

  setResizable(resizable_flag::top | resizable_flag::topLeft
               | resizable_flag::topRight | resizable_flag::bottom
               | resizable_flag::bottomLeft | resizable_flag::bottomRight
               | resizable_flag::left | resizable_flag::right);

Copy link
Contributor

@lmoureaux lmoureaux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two questions from a first look -- will do a more detailed test later on

client/widgetdecorations.h Outdated Show resolved Hide resolved
if (drag_event != -1) {
// constants of min size
constexpr auto min_width = 20;
constexpr auto min_height = 20;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not minimumSizeHint?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not minimumSizeHint?

thank's, fixed

client/widgetdecorations.cpp Outdated Show resolved Hide resolved
resizeFlags = flags;
}

QFlags<resizable_flag> resizable_widget::getResizable() const
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a docstring. Does it make sense to inline it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a docstring. Does it make sense to inline it?

The fact is that there is no point in doing inline in this place, this function is not called so often.
And as you said earlier, it makes sense to do inline only in header files.

client/widgetdecorations.cpp Show resolved Hide resolved
*/
bool resizable_widget::hasResizable(resizable_flag flag) const
{
return resizeFlags.testFlag(flag);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it could be made inline

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it could be made inline

Are you talking about the inline specifier?

inline bool resizable_widget::hasResizable(resizable_flag flag) const {}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The specifier is mostly ignored by compilers nowadays, but we could help them by moving the implementation to the header. Anyway not a critical issue :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The specifier is mostly ignored by compilers nowadays, but we could help them by moving the implementation to the header. Anyway not a critical issue :)

Yeah

@lmoureaux
Copy link
Contributor

lmoureaux commented Jul 3, 2022

Spotted a strange behavior:

  • Grab the bottom left corner of the chat window
  • Move the mouse up until above the top of the chat window. The chat window hits its minimum height, which is fine.
  • Move the mouse down again. The chat window expands, but the corner is "disconnected" from the mouse.

Also found that it's possible to move the chat window out of the screen if the main window is smaller than the screen:

  • Grab the left side, move it to the left (out of the window area)
  • Grab the right side, move it to the left (also out of the window area)

I suggest to prevent moving any edge out of the screen window.

@lmoureaux
Copy link
Contributor

Could also use Qt::Edges instead of a custom enum

@jwrober
Copy link
Collaborator

jwrober commented Jul 16, 2022

Merging with associated issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants