Changing the selection could behave wrongly and result in an assert
failure as the selection anchor could have become invalid, due to the
change of the number of items in the control.
Fix this by invalidating it when this happens.
Not sure if it really helps, but try to wait for the events in these
tests as well if only for consistency with what was done in 3d07de66b1
(Add a wait to wxGrid UI unit tests too, 2023-10-03).
A console program should not really be linked with the GUI library, but it used
to work, and it's unavoidable with the monolithic build, so fix the regression.
See #23981
Added in commit a605ee3 (Don't pass hyphenated shortcuts to Qt) which
mistakenly replaces the last minus sign (-) of an accelerator with plus
sign (+).
Use the right type when inserting new items into the list box. This ensures that
the wxEVT_CHECKLISTBOX event is emitted for these new items. And in fact, it should
be part of this commit 16da1a1 when wxQtListWidgetItem was introduced.
Qt uses QString::localeAwareCompare() for comparison and this is what their
documentation says: "On other Unix-like systems without ICU, the comparison
falls back to the system library's strcoll()". Under MSW, Qt uses CompareStringEx()
IOW, Qt always compares strings by locale-specific sorting criteria and BTW
this is what wxGTK was like before this commit 625ed74 (Make sorting of wxListBox,
wxChoice and wxComboBox identical to the MSW sorting)
Qt spits out annoying warnings about inactive painter (QPainter::font:
Painter not active) when using wxDC::GetChar{Width,Height}(). Simply mute
them by using the default application font explicitly.
The wxListCtrl would assert with this message: '../src/qt/listctrl.cpp(452):
assert "col < columnCount()" failed in SetItem(): Invalid col'
Because under wxQt: no columns means no items, and no items means
no selection can be made at all.
Changes of 9710592cc4 (Erase unwanted list view separators in dark mode
under Windows 11, 2023-06-05) wrongly kept the check for "itemCount",
verifying that the control is not empty, only in the "needToDraw" case,
but it is needed in the "needToErase" case as well because it also uses
the bottom item index which is invalid if there are no items.
Fix this by always checking that the control is non-empty before doing
anything else.
Closes#23960.
Co-authored-by: Vadim Zeitlin <vadim@wxwidgets.org>
QtSet{Min,Max}Size() were added for use by Set{Min,Max}Size() and
DoSetSizeHints() overrides. and since we have canceled overriding
Set{Min,Max}Size() in previous commit, there is no need to keep them
around without good reason.
This partially reverts commit 3c68696 (Make wxTopLevelWindow::SetSizeHints()
work in wxQt) because it breaks some wxSizer tests. and more importantly, it
breaks the documented behaviour of SetMinSize() which says:
Notice that calling this method doesn't prevent the program from making the
window explicitly smaller than the specified size by calling SetSize(), it just
ensures that it won't become smaller than this size during the automatic layout.
Using both wxDEPRECATED_MSG and wxNODISCARD for some reason breaks
compilation with clang (when using C++17 or newer standard).
Since wxBasicString::Get() is deprecated, one warning should be enough
so just remove wxNODISCARD from the method declaration.
Closes#23952.
Also make it clear that wxCHOICE_{HEIGHT,WIDTH} constants are not really
used for anything.
Closes#23949.
Co-authored-by: Vadim Zeitlin <vadim@wxwidgets.org>
Mark it as deprecated in the documentation without deprecating it
formally in the code, as it seems to be used in some existing code and
there is no urgency to remove it, but using it in new code still doesn't
make any sense.
Closes#23945.
The check for the line being deleted being in the visible range
prevented us from refreshing anything at all if the line which was just
deleted was the last line of the control.
When the wxWidgets sources are in a path containing '++', CMake would
show errors on the command line:
[cmake] RegularExpression::compile(): Nested *?+.
[cmake] RegularExpression::compile(): Error in compile
This happens because the full path was interpreted as a regular
expression when creating the source_groups. Without wxSOURCE_DIR the
regular expressions still match and create correct source groups, so
remove it.
Closes#22738.
Closes#23943.
Remove any remaining mouse messages from the input queue after showing
the file dialog because they somehow remain after it is destroyed and
could be processed by the application once wxFileDialog::ShowModal()
returns, resulting in phantom events being processed by the controls
that just happen to be under the button of the file dialog that was
clicked to close it.
Closes#10924, #23944.
Testing for the alpha channel support was a mistake because it is
completely common to initially have a bitmap without an alpha channel (
in which case HasAlpha() returns false ) and Qt correctly converts it to
an appropriate format when the mask is set.
Should have been part of 1e43b37 (Added QtBlendMaskWithAlpha() to
wxBitmap under wxQt).
Closes#23937.
We need to set the window type hint to COMBO in order to use a popup
window for it under Wayland and while not doing it seems to still work
with GNOME/mutter, it is required with the other compositors such as KDE
Plasma or Sway and doesn't seem to do any harm under GNOME, so do it
always and hope that it doesn't result in any problems with not
combobox-like popups.
This basically undoes 62d934aab8 (Don't set HINT_COMBO as wxPopupWindow
is used for different windows as well, 2008-10-07).
See #23931.
Closes#23908.
Co-authored-by: Alex Shvartzkop <dudesuchamazing@gmail.com>