mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-09-26 09:56:32 +08:00
Merge branch 'qt-fixes' of https://github.com/AliKet/wxWidgets
Many wxQt improvements and simplifications. See #24135.
This commit is contained in:
@@ -24,13 +24,6 @@ public:
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxASCII_STR(wxControlNameStr));
|
||||
|
||||
virtual wxSize DoGetBestSize() const override;
|
||||
|
||||
protected:
|
||||
bool QtCreateControl( wxWindow *parent, wxWindowID id, const wxPoint &pos,
|
||||
const wxSize &size, long style, const wxValidator &validator,
|
||||
const wxString &name );
|
||||
|
||||
private:
|
||||
wxDECLARE_DYNAMIC_CLASS(wxControl);
|
||||
};
|
||||
|
||||
@@ -46,7 +46,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class WXDLLIMPEXP_CORE wxPaintDCImpl : public wxClientDCImpl
|
||||
class WXDLLIMPEXP_CORE wxPaintDCImpl : public wxWindowDCImpl
|
||||
{
|
||||
public:
|
||||
wxPaintDCImpl( wxDC *owner );
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "wx/frame.h"
|
||||
|
||||
class QMainWindow;
|
||||
class QScrollArea;
|
||||
|
||||
class WXDLLIMPEXP_CORE wxFrame : public wxFrameBase
|
||||
{
|
||||
@@ -51,7 +50,6 @@ public:
|
||||
virtual void RemoveChild( wxWindowBase *child ) override;
|
||||
|
||||
QMainWindow *GetQMainWindow() const;
|
||||
virtual QScrollArea *QtGetScrollBarsContainer() const override;
|
||||
|
||||
protected:
|
||||
virtual wxPoint GetClientAreaOrigin() const override;
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
class QListWidget;
|
||||
class QModelIndex;
|
||||
class QScrollArea;
|
||||
|
||||
class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase
|
||||
{
|
||||
@@ -87,8 +86,6 @@ protected:
|
||||
|
||||
virtual int DoListHitTest(const wxPoint& point) const override;
|
||||
|
||||
virtual QScrollArea *QtGetScrollBarsContainer() const override;
|
||||
|
||||
#if wxUSE_CHECKLISTBOX
|
||||
bool m_hasCheckBoxes;
|
||||
#endif // wxUSE_CHECKLISTBOX
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: include/wx/qt/winevent_qt.h
|
||||
// Name: include/wx/qt/private/winevent.h
|
||||
// Purpose: QWidget to wxWindow event handler
|
||||
// Author: Javier Torres, Peter Most
|
||||
// Created: 21.06.10
|
||||
@@ -371,7 +371,7 @@ protected:
|
||||
virtual bool winEvent ( MSG * message, long * result ) { }
|
||||
virtual bool x11Event ( XEvent * event ) { } */
|
||||
|
||||
virtual bool event(QEvent *event)
|
||||
virtual bool event(QEvent *event) override
|
||||
{
|
||||
if (event->type() == QEvent::Gesture)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#ifndef _WX_QT_TEXTCTRL_H_
|
||||
#define _WX_QT_TEXTCTRL_H_
|
||||
|
||||
class QScrollArea;
|
||||
class wxQtEdit;
|
||||
|
||||
class WXDLLIMPEXP_CORE wxTextCtrl : public wxTextCtrlBase
|
||||
@@ -93,8 +92,6 @@ protected:
|
||||
virtual bool DoLoadFile(const wxString& file, int fileType) override;
|
||||
virtual bool DoSaveFile(const wxString& file, int fileType) override;
|
||||
|
||||
virtual QScrollArea *QtGetScrollBarsContainer() const override;
|
||||
|
||||
// From wxTextEntry:
|
||||
virtual wxWindow *GetEditableWindow() override { return this; }
|
||||
|
||||
|
||||
+26
-33
@@ -14,46 +14,37 @@
|
||||
class QShortcut;
|
||||
template < class T > class QList;
|
||||
|
||||
class QWidget;
|
||||
class QScrollArea;
|
||||
class QScrollBar;
|
||||
class QPicture;
|
||||
class QAbstractScrollArea;
|
||||
class QPainter;
|
||||
class QPicture;
|
||||
class QScrollBar;
|
||||
class QWidget;
|
||||
|
||||
class QCloseEvent;
|
||||
class QContextMenuEvent;
|
||||
class QEvent;
|
||||
class QFocusEvent;
|
||||
class QKeyEvent;
|
||||
class QPaintEvent;
|
||||
class QResizeEvent;
|
||||
class QWheelEvent;
|
||||
class QKeyEvent;
|
||||
class QMouseEvent;
|
||||
class QEvent;
|
||||
class QMoveEvent;
|
||||
class QEvent;
|
||||
class QEvent;
|
||||
class QCloseEvent;
|
||||
class QContextMenuEvent;
|
||||
class QFocusEvent;
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
class WXDLLIMPEXP_FWD_CORE wxQtShortcutHandler;
|
||||
|
||||
/* wxQt specific notes:
|
||||
*
|
||||
* Remember to implement the Qt object getters on all subclasses:
|
||||
* - GetHandle() returns the Qt object
|
||||
* - QtGetScrollBarsContainer() returns the widget where scrollbars are placed
|
||||
* For example, for wxFrame, GetHandle() is the QMainWindow,
|
||||
* QtGetScrollBarsContainer() is the central widget and QtGetContainer() is a widget
|
||||
* in a layout inside the central widget that also contains the scrollbars.
|
||||
* Return 0 from QtGetScrollBarsContainer() to disable SetScrollBar() and friends
|
||||
* for wxWindow subclasses.
|
||||
*
|
||||
*
|
||||
* Event handling is achieved by using the template class wxQtEventForwarder
|
||||
* found in winevent_qt.(h|cpp) to send all Qt events here to QtHandleXXXEvent()
|
||||
* methods. All these methods receive the Qt event and the handler. This is
|
||||
* done because events of the containers (the scrolled part of the window) are
|
||||
* sent to the same wxWindow instance, that must be able to differentiate them
|
||||
* as some events need different handling (paintEvent) depending on that.
|
||||
* Event handling is achieved by using the template class wxQtEventSignalHandler
|
||||
* found in winevent.h to send all Qt events here to QtHandleXXXEvent() methods.
|
||||
* All these methods receive the Qt event and the handler. This is done because
|
||||
* events of the containers (the scrolled part of the window) are sent to the
|
||||
* same wxWindow instance, that must be able to differentiate them as some events
|
||||
* need different handling (paintEvent) depending on that.
|
||||
* We pass the QWidget pointer to all event handlers for consistency.
|
||||
*/
|
||||
class WXDLLIMPEXP_CORE wxWindowQt : public wxWindowBase
|
||||
@@ -75,7 +66,8 @@ public:
|
||||
long style = 0,
|
||||
const wxString& name = wxASCII_STR(wxPanelNameStr));
|
||||
|
||||
// Used by all window classes in the widget creation process.
|
||||
// Derived classes have to call PostCreation() explicitly if they don't call
|
||||
// our Create() method during widget creation process.
|
||||
void PostCreation( bool generic = true );
|
||||
|
||||
void AddChild( wxWindowBase *child ) override;
|
||||
@@ -136,6 +128,9 @@ public:
|
||||
virtual bool SetBackgroundColour(const wxColour& colour) override;
|
||||
virtual bool SetForegroundColour(const wxColour& colour) override;
|
||||
|
||||
virtual void SetDoubleBuffered(bool on) override;
|
||||
virtual bool IsDoubleBuffered() const override;
|
||||
|
||||
QWidget *GetHandle() const override;
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
@@ -178,8 +173,6 @@ public:
|
||||
virtual void QtHandleShortcut ( int command );
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
virtual QScrollArea *QtGetScrollBarsContainer() const;
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
// applies tooltip to the widget.
|
||||
virtual void QtApplyToolTip(const wxString& text);
|
||||
@@ -210,6 +203,8 @@ protected:
|
||||
virtual void DoSetClientSize(int width, int height) override;
|
||||
virtual void DoGetClientSize(int *width, int *height) const override;
|
||||
|
||||
virtual wxSize DoGetBestSize() const override;
|
||||
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height) override;
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
@@ -225,14 +220,13 @@ protected:
|
||||
// itself.
|
||||
virtual QWidget* QtGetParentWidget() const { return GetHandle(); }
|
||||
|
||||
QWidget *m_qtWindow;
|
||||
QWidget *m_qtWindow;
|
||||
QAbstractScrollArea *m_qtContainer; // either nullptr or the same as m_qtWindow pointer
|
||||
// if m_qtWindow derives from QAbstractScrollArea,
|
||||
// e.g. QListWidget and QTextEdit.
|
||||
|
||||
private:
|
||||
void Init();
|
||||
QScrollArea *m_qtContainer; // either nullptr or the same as m_qtWindow pointer
|
||||
|
||||
QScrollBar *m_horzScrollBar; // owned by m_qtWindow when allocated
|
||||
QScrollBar *m_vertScrollBar; // owned by m_qtWindow when allocated
|
||||
|
||||
// Return the viewport of m_qtContainer, if it's used, or just m_qtWindow.
|
||||
//
|
||||
@@ -240,7 +234,6 @@ private:
|
||||
QWidget *QtGetClientWidget() const;
|
||||
|
||||
QScrollBar *QtGetScrollBar( int orientation ) const;
|
||||
QScrollBar *QtSetScrollBar( int orientation, QScrollBar *scrollBar=nullptr );
|
||||
|
||||
bool QtSetBackgroundStyle();
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "wx/artprov.h"
|
||||
#include "wx/clipbrd.h"
|
||||
#include "wx/image.h"
|
||||
#include "wx/choice.h"
|
||||
#include "wx/colordlg.h"
|
||||
#include "wx/wxhtml.h"
|
||||
#include "wx/imaglist.h"
|
||||
@@ -29,6 +30,7 @@
|
||||
#include "wx/statusbr.h"
|
||||
#include "wx/msgdlg.h"
|
||||
#include "wx/textdlg.h"
|
||||
#include "wx/stattext.h"
|
||||
|
||||
#include "wx/aui/aui.h"
|
||||
#include "../sample.xpm"
|
||||
@@ -1261,7 +1263,7 @@ void MyFrame::OnUpdateUI(wxUpdateUIEvent& event)
|
||||
break;
|
||||
|
||||
case ID_NotebookNoCloseButton:
|
||||
event.Check((m_notebook_style & (wxAUI_NB_CLOSE_BUTTON|wxAUI_NB_CLOSE_ON_ALL_TABS|wxAUI_NB_CLOSE_ON_ACTIVE_TAB)) != 0);
|
||||
event.Check((m_notebook_style & (wxAUI_NB_CLOSE_BUTTON|wxAUI_NB_CLOSE_ON_ALL_TABS|wxAUI_NB_CLOSE_ON_ACTIVE_TAB)) == 0);
|
||||
break;
|
||||
case ID_NotebookCloseButton:
|
||||
event.Check((m_notebook_style & wxAUI_NB_CLOSE_BUTTON) != 0);
|
||||
|
||||
@@ -762,7 +762,7 @@ unsigned int wxAuiManager::GetFlags() const
|
||||
|
||||
// With Core Graphics on Mac or GTK 3, it's not possible to show sash feedback,
|
||||
// so we'll always use live update instead.
|
||||
#if defined(__WXMAC__) || defined(__WXGTK3__)
|
||||
#if defined(__WXMAC__) || defined(__WXGTK3__) || defined(__WXQT__)
|
||||
#define wxUSE_AUI_LIVE_RESIZE_ALWAYS 1
|
||||
#else
|
||||
#define wxUSE_AUI_LIVE_RESIZE_ALWAYS 0
|
||||
@@ -3911,7 +3911,7 @@ void wxAuiManager::Render(wxDC* dc)
|
||||
|
||||
void wxAuiManager::Repaint(wxDC* dc)
|
||||
{
|
||||
#if defined(__WXMAC__) || defined(__WXGTK3__)
|
||||
#if defined(__WXMAC__) || defined(__WXGTK3__) || defined(__WXQT__)
|
||||
// We can't use wxClientDC in these ports.
|
||||
if ( dc == nullptr )
|
||||
{
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id,
|
||||
QtCreate(parent);
|
||||
SetLabel( label.IsEmpty() && wxIsStockID( id ) ? wxGetStockLabel( id ) : label );
|
||||
|
||||
return QtCreateControl( parent, id, pos, size, style, validator, name );
|
||||
return wxButtonBase::Create( parent, id, pos, size, style, validator, name );
|
||||
}
|
||||
|
||||
wxWindow *wxButton::SetDefault()
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ bool wxCalendarCtrl::Create(wxWindow *parent, wxWindowID id, const wxDateTime& d
|
||||
if ( date.IsValid() )
|
||||
SetDate(date);
|
||||
|
||||
return QtCreateControl( parent, id, pos, size, style, wxDefaultValidator, name );
|
||||
return wxCalendarCtrlBase::Create( parent, id, pos, size, style, wxDefaultValidator, name );
|
||||
}
|
||||
|
||||
void wxCalendarCtrl::UpdateStyle()
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
||||
m_qtCheckBox->setText( wxQtConvertString( label ) );
|
||||
|
||||
// Do the initialization here as WXValidateStyle may fail in unit tests
|
||||
bool ok = QtCreateControl( parent, id, pos, size, style, validator, name );
|
||||
bool ok = wxCheckBoxBase::Create( parent, id, pos, size, style, validator, name );
|
||||
|
||||
WXValidateStyle(&style);
|
||||
|
||||
|
||||
+1
-1
@@ -138,7 +138,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
|
||||
while ( n-- > 0 )
|
||||
m_qtComboBox->addItem( wxQtConvertString( *choices++ ));
|
||||
|
||||
return QtCreateControl( parent, id, pos, size, style, validator, name );
|
||||
return wxChoiceBase::Create( parent, id, pos, size, style, validator, name );
|
||||
}
|
||||
|
||||
wxSize wxChoice::DoGetBestSize() const
|
||||
|
||||
+1
-1
@@ -149,7 +149,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
|
||||
m_qtComboBox->addItem( wxQtConvertString( *choices++ ));
|
||||
m_qtComboBox->setCurrentText( wxQtConvertString( value ));
|
||||
|
||||
return QtCreateControl( parent, id, pos, size, style, validator, name );
|
||||
return wxChoiceBase::Create( parent, id, pos, size, style, validator, name );
|
||||
}
|
||||
|
||||
bool wxComboBox::IsReadOnly() const
|
||||
|
||||
@@ -43,37 +43,3 @@ bool wxControl::Create(wxWindow *parent, wxWindowID id,
|
||||
|
||||
return isCreated;
|
||||
}
|
||||
|
||||
bool wxControl::QtCreateControl( wxWindow *parent, wxWindowID id,
|
||||
const wxPoint &pos, const wxSize &size, long style,
|
||||
const wxValidator &validator, const wxString &name )
|
||||
{
|
||||
// The Qt widget has been created without a position/size so move/resize it:
|
||||
|
||||
wxSize bestSize = GetBestSize();
|
||||
int width = ( size.GetWidth() == wxDefaultCoord ) ? bestSize.GetWidth() : size.GetWidth();
|
||||
int height = ( size.GetHeight() == wxDefaultCoord ) ? bestSize.GetHeight() : size.GetHeight();
|
||||
|
||||
DoMoveWindow( pos.x, pos.y, width, height );
|
||||
|
||||
// Let Qt handle the background:
|
||||
SetBackgroundStyle(wxBG_STYLE_SYSTEM);
|
||||
|
||||
if (!CreateControl( parent, id, pos, size, style, validator, name ))
|
||||
return false;
|
||||
|
||||
PostCreation(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
wxSize wxControl::DoGetBestSize() const
|
||||
{
|
||||
wxSize minsize = wxQtConvertSize( GetHandle()->minimumSizeHint() );
|
||||
wxSize size = wxQtConvertSize( GetHandle()->sizeHint() );
|
||||
// best effort to ensure a correct size (note that some qt controls implement just one or both size hints)
|
||||
if (size.GetWidth() < minsize.GetWidth())
|
||||
size.SetWidth(minsize.GetWidth());
|
||||
if (size.GetHeight() < minsize.GetHeight())
|
||||
size.SetHeight(minsize.GetHeight());
|
||||
return size;
|
||||
}
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ wxDatePickerCtrl::Create(wxWindow *parent,
|
||||
m_qtDateEdit->setCalendarPopup(style & wxDP_DROPDOWN);
|
||||
m_qtDateEdit->setDisplayFormat(QLocale::system().dateFormat(QLocale::ShortFormat));
|
||||
|
||||
return QtCreateControl( parent, id, pos, size, style, validator, name );
|
||||
return wxDatePickerCtrlBase::Create( parent, id, pos, size, style, validator, name );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
+4
-4
@@ -10,6 +10,7 @@
|
||||
|
||||
|
||||
#include <QtGui/QPicture>
|
||||
#include <QtWidgets/QWidget>
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
@@ -20,7 +21,6 @@
|
||||
#include "wx/qt/dcclient.h"
|
||||
#include "wx/qt/private/converter.h"
|
||||
|
||||
#include <QtWidgets/QScrollArea>
|
||||
#include <QtGui/QPainter>
|
||||
|
||||
//##############################################################################
|
||||
@@ -116,15 +116,15 @@ wxClientDCImpl::wxClientDCImpl( wxDC *owner, wxWindow *win )
|
||||
|
||||
//##############################################################################
|
||||
|
||||
wxIMPLEMENT_CLASS(wxPaintDCImpl,wxClientDCImpl);
|
||||
wxIMPLEMENT_CLASS(wxPaintDCImpl,wxWindowDCImpl);
|
||||
|
||||
wxPaintDCImpl::wxPaintDCImpl( wxDC *owner )
|
||||
: wxClientDCImpl( owner )
|
||||
: wxWindowDCImpl( owner )
|
||||
{
|
||||
}
|
||||
|
||||
wxPaintDCImpl::wxPaintDCImpl( wxDC *owner, wxWindow *win )
|
||||
: wxClientDCImpl( owner, win )
|
||||
: wxWindowDCImpl( owner, win )
|
||||
{
|
||||
wxCHECK_RET( m_isWindowPainter,
|
||||
"wxPaintDC can't be created outside wxEVT_PAINT handler" );
|
||||
|
||||
+1
-6
@@ -70,12 +70,7 @@ bool wxDialog::Create( wxWindow *parent, wxWindowID id,
|
||||
m_qtWindow->setWindowFlags(qtFlags);
|
||||
}
|
||||
|
||||
if ( !wxTopLevelWindow::Create( parent, id, title, pos, size, style, name ) )
|
||||
return false;
|
||||
|
||||
PostCreation();
|
||||
|
||||
return true;
|
||||
return wxTopLevelWindow::Create( parent, id, title, pos, size, style, name );
|
||||
}
|
||||
|
||||
int wxDialog::ShowModal()
|
||||
|
||||
+22
-81
@@ -19,25 +19,31 @@
|
||||
#include "wx/qt/private/converter.h"
|
||||
#include "wx/qt/private/winevent.h"
|
||||
|
||||
#include <QtWidgets/QScrollArea>
|
||||
#include <QtWidgets/QMainWindow>
|
||||
#include <QtWidgets/QMenuBar>
|
||||
|
||||
class wxQtMainWindow : public wxQtEventSignalHandler< QMainWindow, wxFrame >
|
||||
{
|
||||
public:
|
||||
wxQtMainWindow( wxWindow *parent, wxFrame *handler );
|
||||
wxQtMainWindow( wxWindow *parent, wxFrame *handler )
|
||||
: wxQtEventSignalHandler< QMainWindow, wxFrame >( parent, handler )
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
virtual bool focusNextPrevChild(bool) override { return false; }
|
||||
};
|
||||
|
||||
// Central widget helper (container to show scroll bars and receive events):
|
||||
// Central widget helper (container which receives events):
|
||||
|
||||
class wxQtCentralWidget : public wxQtEventSignalHandler< QScrollArea, wxFrame >
|
||||
class wxQtCentralWidget : public wxQtEventSignalHandler< QWidget, wxFrame >
|
||||
{
|
||||
public:
|
||||
wxQtCentralWidget( wxWindow *parent, wxFrame *handler );
|
||||
public:
|
||||
wxQtCentralWidget( wxWindow *parent, wxFrame *handler )
|
||||
: wxQtEventSignalHandler< QWidget, wxFrame >( parent, handler )
|
||||
{
|
||||
setFocusPolicy(Qt::NoFocus);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -52,15 +58,18 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString& title,
|
||||
{
|
||||
m_qtWindow = new wxQtMainWindow( parent, this );
|
||||
|
||||
// TODO: Could we use a wxPanel as the central widget? If so then we could
|
||||
// remove wxWindow::QtReparent.
|
||||
|
||||
GetQMainWindow()->setCentralWidget( new wxQtCentralWidget( parent, this ) );
|
||||
// QMainWindow takes ownership of the central widget pointer.
|
||||
// Not using QScrollArea or wxPanel is intentional here as it makes the
|
||||
// implementation simpler and more manageable.
|
||||
GetQMainWindow()->setCentralWidget( new wxQtCentralWidget( this, this ) );
|
||||
|
||||
if ( !wxFrameBase::Create( parent, id, title, pos, size, style, name ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
SetWindowStyleFlag(style);
|
||||
|
||||
PostCreation();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -91,8 +100,6 @@ void wxFrame::SetStatusBar( wxStatusBar *statusBar )
|
||||
if ( statusBar != nullptr )
|
||||
{
|
||||
GetQMainWindow()->setStatusBar( statusBar->GetQStatusBar() );
|
||||
// Update statusbar sizes now that it has a size
|
||||
statusBar->Refresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -203,68 +210,16 @@ void wxFrame::RemoveChild( wxWindowBase *child )
|
||||
wxFrameBase::RemoveChild( child );
|
||||
}
|
||||
|
||||
QScrollArea *wxFrame::QtGetScrollBarsContainer() const
|
||||
{
|
||||
return dynamic_cast <QScrollArea *> (GetQMainWindow()->centralWidget() );
|
||||
}
|
||||
|
||||
// get the origin of the client area in the client coordinates
|
||||
// excluding any menubar and toolbar if any.
|
||||
wxPoint wxFrame::GetClientAreaOrigin() const
|
||||
{
|
||||
wxPoint pt = wxTopLevelWindow::GetClientAreaOrigin();
|
||||
|
||||
// It seems that Qt always adds 1px border around QMainWindow,
|
||||
// being resizable or not, so account for it here.
|
||||
pt += wxPoint(1, 1);
|
||||
|
||||
#ifndef __WXUNIVERSAL__
|
||||
#if wxUSE_MENUBAR
|
||||
wxMenuBar * const menubar = GetMenuBar();
|
||||
if ( menubar && menubar->IsAttached() )
|
||||
pt.y += menubar->GetSize().y;
|
||||
#endif // wxUSE_MENUBAR
|
||||
|
||||
#if wxUSE_TOOLBAR
|
||||
wxToolBar * const toolbar = GetToolBar();
|
||||
if ( toolbar && toolbar->IsShown() )
|
||||
{
|
||||
const wxSize sizeTB = toolbar->GetSize();
|
||||
const int directionTB = toolbar->GetDirection();
|
||||
|
||||
if ( directionTB == wxTB_TOP )
|
||||
{
|
||||
pt.y += sizeTB.y;
|
||||
}
|
||||
else if ( directionTB == wxTB_LEFT )
|
||||
{
|
||||
pt.x += sizeTB.x;
|
||||
}
|
||||
}
|
||||
#endif // wxUSE_TOOLBAR
|
||||
#endif // __WXUNIVERSAL__
|
||||
|
||||
return pt;
|
||||
return wxQtConvertPoint( GetQMainWindow()->centralWidget()->pos() );
|
||||
}
|
||||
|
||||
void wxFrame::DoGetClientSize(int *width, int *height) const
|
||||
{
|
||||
wxWindow::DoGetClientSize(width, height);
|
||||
|
||||
// Adjust the height, taking the status and menu bars into account, if any:
|
||||
if ( height )
|
||||
{
|
||||
if ( wxStatusBar *sb = GetStatusBar() )
|
||||
{
|
||||
*height -= sb->GetSize().y;
|
||||
}
|
||||
|
||||
|
||||
if ( QWidget *qmb = GetQMainWindow()->menuWidget() )
|
||||
{
|
||||
*height -= qmb->geometry().height();
|
||||
}
|
||||
}
|
||||
wxFrameBase::DoGetClientSize(width, height);
|
||||
}
|
||||
|
||||
void wxFrame::DoSetClientSize(int width, int height)
|
||||
@@ -284,17 +239,3 @@ QMainWindow *wxFrame::GetQMainWindow() const
|
||||
{
|
||||
return static_cast<QMainWindow*>(m_qtWindow);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
wxQtMainWindow::wxQtMainWindow( wxWindow *parent, wxFrame *handler )
|
||||
: wxQtEventSignalHandler< QMainWindow, wxFrame >( parent, handler )
|
||||
{
|
||||
// setCentralWidget( new wxQtWidget( parent, handler ));
|
||||
}
|
||||
|
||||
wxQtCentralWidget::wxQtCentralWidget( wxWindow *parent, wxFrame *handler )
|
||||
: wxQtEventSignalHandler< QScrollArea, wxFrame >( parent, handler )
|
||||
{
|
||||
setFocusPolicy(Qt::NoFocus);
|
||||
}
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ bool wxGauge::Create(wxWindow *parent,
|
||||
m_qtProgressBar->setTextVisible( style & wxGA_TEXT );
|
||||
m_qtProgressBar->setValue(0);
|
||||
|
||||
return QtCreateControl( parent, id, pos, size, style, validator, name );
|
||||
return wxControl::Create( parent, id, pos, size, style, validator, name );
|
||||
}
|
||||
|
||||
|
||||
|
||||
+6
-7
@@ -137,7 +137,9 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
||||
}
|
||||
m_qtListWidget->addItem(item);
|
||||
}
|
||||
return wxListBoxBase::Create( parent, id, pos, size, style, validator, name );
|
||||
return wxListBoxBase::Create( parent, id, pos, size,
|
||||
style | wxVSCROLL | wxHSCROLL,
|
||||
validator, name );
|
||||
}
|
||||
|
||||
bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
||||
@@ -170,7 +172,9 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
||||
m_qtListWidget->addItem(item);
|
||||
}
|
||||
|
||||
return wxListBoxBase::Create( parent, id, pos, size, style, validator, name );
|
||||
return wxListBoxBase::Create( parent, id, pos, size,
|
||||
style | wxVSCROLL | wxHSCROLL,
|
||||
validator, name );
|
||||
}
|
||||
|
||||
void wxListBox::DoCreate(wxWindow* parent, long style)
|
||||
@@ -368,11 +372,6 @@ void wxListBox::QtSendEvent(wxEventType evtType, int rowIndex, bool selected)
|
||||
SendEvent(evtType, rowIndex, selected);
|
||||
}
|
||||
|
||||
QScrollArea *wxListBox::QtGetScrollBarsContainer() const
|
||||
{
|
||||
return (QScrollArea *) m_qtListWidget;
|
||||
}
|
||||
|
||||
void wxListBox::UnSelectAll()
|
||||
{
|
||||
Q_FOREACH(QListWidgetItem* l, m_qtListWidget->selectedItems())
|
||||
|
||||
+4
-1
@@ -1347,6 +1347,7 @@ bool wxListCtrl::Create(wxWindow *parent,
|
||||
? new wxQtVirtualListModel(this)
|
||||
: new wxQtListModel(this);
|
||||
|
||||
m_qtWindow =
|
||||
m_qtTreeWidget = new wxQtListTreeWidget(parent, this);
|
||||
m_qtTreeWidget->setModel(m_model);
|
||||
m_model->SetView(m_qtTreeWidget);
|
||||
@@ -1355,7 +1356,9 @@ bool wxListCtrl::Create(wxWindow *parent,
|
||||
m_qtTreeWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
m_qtTreeWidget->setTabKeyNavigation(true);
|
||||
|
||||
if ( !QtCreateControl(parent, id, pos, size, style, validator, name) )
|
||||
if ( !wxListCtrlBase::Create(parent, id, pos, size,
|
||||
style | wxVSCROLL | wxHSCROLL,
|
||||
validator, name) )
|
||||
return false;
|
||||
|
||||
SetWindowStyleFlag(style);
|
||||
|
||||
+7
-5
@@ -213,23 +213,25 @@ QMenu *wxMenu::GetHandle() const
|
||||
wxMenuBar::wxMenuBar()
|
||||
{
|
||||
m_qtMenuBar = new QMenuBar();
|
||||
PostCreation(false);
|
||||
|
||||
wxMenuBarBase::Create(nullptr, wxID_ANY);
|
||||
}
|
||||
|
||||
wxMenuBar::wxMenuBar( long WXUNUSED( style ))
|
||||
wxMenuBar::wxMenuBar( long style )
|
||||
{
|
||||
m_qtMenuBar = new QMenuBar();
|
||||
PostCreation(false);
|
||||
|
||||
wxMenuBarBase::Create(nullptr, wxID_ANY, wxDefaultPosition, wxDefaultSize, style);
|
||||
}
|
||||
|
||||
wxMenuBar::wxMenuBar(size_t count, wxMenu *menus[], const wxString titles[], long WXUNUSED( style ))
|
||||
wxMenuBar::wxMenuBar(size_t count, wxMenu *menus[], const wxString titles[], long style)
|
||||
{
|
||||
m_qtMenuBar = new QMenuBar();
|
||||
|
||||
for ( size_t i = 0; i < count; ++i )
|
||||
Append( menus[ i ], titles[ i ] );
|
||||
|
||||
PostCreation(false);
|
||||
wxMenuBarBase::Create(nullptr, wxID_ANY, wxDefaultPosition, wxDefaultSize, style);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -109,7 +109,7 @@ wxMessageDialog::wxMessageDialog( wxWindow *parent, const wxString& message,
|
||||
if ( style & wxSTAY_ON_TOP )
|
||||
dlg->setWindowModality( Qt::ApplicationModal );
|
||||
|
||||
PostCreation();
|
||||
PostCreation(false);
|
||||
|
||||
Centre(wxBOTH | wxCENTER_FRAME);
|
||||
}
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ bool wxNotebook::Create(wxWindow *parent,
|
||||
{
|
||||
m_qtTabWidget = new wxQtTabWidget( parent, this );
|
||||
|
||||
if ( !QtCreateControl( parent, id, pos, size, style, wxDefaultValidator, name ) )
|
||||
if ( !wxControl::Create( parent, id, pos, size, style, wxDefaultValidator, name ) )
|
||||
return false;
|
||||
|
||||
if ( m_windowStyle & wxBK_RIGHT )
|
||||
|
||||
+1
-1
@@ -196,7 +196,7 @@ bool wxRadioBox::Create(wxWindow *parent,
|
||||
m_qtGroupBox->setLayout(horzLayout);
|
||||
|
||||
SetMajorDim(majorDim == 0 ? n : majorDim, style);
|
||||
return QtCreateControl( parent, id, pos, size, style, val, name );
|
||||
return wxControl::Create( parent, id, pos, size, style, val, name );
|
||||
}
|
||||
|
||||
static QAbstractButton *GetButtonAt( const QButtonGroup *group, unsigned int n )
|
||||
|
||||
+1
-1
@@ -127,7 +127,7 @@ bool wxRadioButton::Create( wxWindow *parent,
|
||||
m_qtRadioButton = new wxQtRadioButton( parent, this );
|
||||
m_qtRadioButton->setText( wxQtConvertString( label ));
|
||||
|
||||
if ( !QtCreateControl(parent, id, pos, size, style, validator, name) )
|
||||
if ( !wxRadioButtonBase::Create(parent, id, pos, size, style, validator, name) )
|
||||
return false;
|
||||
|
||||
// Check if we need to create a new button group: this must be done when
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ bool wxScrollBar::Create( wxWindow *parent, wxWindowID id,
|
||||
m_qtScrollBar = new wxQtScrollBar( parent, this );
|
||||
m_qtScrollBar->setOrientation( wxQtConvertOrientation( style, wxSB_HORIZONTAL ));
|
||||
|
||||
return QtCreateControl( parent, id, pos, size, style, validator, name );
|
||||
return wxScrollBarBase::Create( parent, id, pos, size, style, validator, name );
|
||||
}
|
||||
|
||||
int wxScrollBar::GetThumbPosition() const
|
||||
|
||||
+2
-2
@@ -174,10 +174,10 @@ bool wxSlider::Create(wxWindow *parent,
|
||||
SetValue( value );
|
||||
SetPageSize(wxMax(1, (maxValue - minValue) / 10));
|
||||
|
||||
if ( !QtCreateControl( parent, id, pos, size, style, validator, name ) )
|
||||
if ( !wxSliderBase::Create( parent, id, pos, size, style, validator, name ) )
|
||||
return false;
|
||||
|
||||
// SetTick() needs the window style which is normally set after QtCreateControl()
|
||||
// SetTick() needs the window style which is normally set after wxSliderBase::Create()
|
||||
// is called. Pass 0 as tickPos parameter is not used by Qt anyhow.
|
||||
SetTick( 0 );
|
||||
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ bool wxSpinButton::Create(wxWindow *parent,
|
||||
wxSize newSize( size );
|
||||
newSize.SetWidth( 18 );
|
||||
|
||||
return QtCreateControl( parent, id, pos, newSize, style, wxDefaultValidator, name );
|
||||
return wxSpinButtonBase::Create( parent, id, pos, newSize, style, wxDefaultValidator, name );
|
||||
}
|
||||
|
||||
void wxSpinButton::SetRange(int min, int max)
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ bool wxSpinCtrlQt< T, Widget >::Create( wxWindow *parent, wxWindowID id,
|
||||
if ( !value.IsEmpty() )
|
||||
SetValue( value );
|
||||
|
||||
return QtCreateControl( parent, id, pos, size, style, wxDefaultValidator, name );
|
||||
return wxSpinCtrlBase::Create( parent, id, pos, size, style, wxDefaultValidator, name );
|
||||
}
|
||||
|
||||
template< typename T, typename Widget >
|
||||
|
||||
+14
-6
@@ -52,7 +52,7 @@ bool wxStaticBitmap::Create( wxWindow *parent,
|
||||
m_qtLabel = new wxQtStaticBmp( parent, this );
|
||||
SetBitmap( label );
|
||||
|
||||
return QtCreateControl( parent, id, pos, size, style, wxDefaultValidator, name );
|
||||
return wxStaticBitmapBase::Create( parent, id, pos, size, style, wxDefaultValidator, name );
|
||||
}
|
||||
|
||||
static void SetPixmap( QLabel *label, const QPixmap *pixMap )
|
||||
@@ -63,16 +63,24 @@ static void SetPixmap( QLabel *label, const QPixmap *pixMap )
|
||||
|
||||
void wxStaticBitmap::SetBitmap(const wxBitmapBundle& bitmap)
|
||||
{
|
||||
m_bitmapBundle = bitmap;
|
||||
|
||||
SetPixmap( m_qtLabel, bitmap.GetBitmapFor(this).GetHandle() );
|
||||
|
||||
InvalidateBestSize();
|
||||
}
|
||||
|
||||
wxBitmap wxStaticBitmap::GetBitmap() const
|
||||
{
|
||||
const QPixmap* pix = m_qtLabel->pixmap();
|
||||
if ( pix != nullptr )
|
||||
return wxBitmap( *pix );
|
||||
else
|
||||
return wxBitmap();
|
||||
wxBitmap bitmap = m_bitmapBundle.GetBitmapFor(this);
|
||||
if ( !bitmap.IsOk() )
|
||||
{
|
||||
const QPixmap* pix = m_qtLabel->pixmap();
|
||||
if ( pix != nullptr )
|
||||
bitmap = wxBitmap( *pix );
|
||||
}
|
||||
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
QWidget *wxStaticBitmap::GetHandle() const
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
|
||||
m_qtGroupBox = new wxQtGroupBox( parent, this );
|
||||
m_qtGroupBox->setTitle( wxQtConvertString( label ) );
|
||||
|
||||
return QtCreateControl( parent, id, pos, size, style, wxDefaultValidator, name );
|
||||
return wxStaticBoxBase::Create( parent, id, pos, size, style, wxDefaultValidator, name );
|
||||
}
|
||||
|
||||
QWidget *wxStaticBox::GetHandle() const
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ bool wxStaticLine::Create( wxWindow *parent,
|
||||
else if ( style & wxLI_VERTICAL )
|
||||
m_qtFrame->setFrameStyle( QFrame::VLine );
|
||||
|
||||
return QtCreateControl( parent, id, pos, size, style, wxDefaultValidator, name );
|
||||
return wxStaticLineBase::Create( parent, id, pos, size, style, wxDefaultValidator, name );
|
||||
}
|
||||
|
||||
QWidget *wxStaticLine::GetHandle() const
|
||||
|
||||
+1
-4
@@ -63,12 +63,9 @@ bool wxStaticText::Create(wxWindow *parent,
|
||||
else
|
||||
m_qtLabel->setAlignment(Qt::AlignLeft);
|
||||
|
||||
if ( !QtCreateControl(parent, id, pos, size, style, wxDefaultValidator, name) )
|
||||
return false;
|
||||
|
||||
SetLabel(label);
|
||||
|
||||
return true;
|
||||
return wxStaticTextBase::Create(parent, id, pos, size, style, wxDefaultValidator, name);
|
||||
}
|
||||
|
||||
void wxStaticText::SetLabel(const wxString& label)
|
||||
|
||||
@@ -43,15 +43,13 @@ bool wxStatusBar::Create(wxWindow *parent, wxWindowID id,
|
||||
{
|
||||
m_qtStatusBar = new wxQtStatusBar( parent, this );
|
||||
|
||||
if ( !QtCreateControl( parent, id, wxDefaultPosition, wxDefaultSize,
|
||||
if ( !wxStatusBarBase::Create( parent, id, wxDefaultPosition, wxDefaultSize,
|
||||
style, wxDefaultValidator, name ) )
|
||||
return false;
|
||||
|
||||
if ( style & wxSTB_SIZEGRIP )
|
||||
m_qtStatusBar->setSizeGripEnabled(true);
|
||||
|
||||
PostCreation();
|
||||
|
||||
SetFieldsCount(1);
|
||||
|
||||
// Notice that child controls, if any, will be added using addWidget() in
|
||||
|
||||
+18
-19
@@ -44,7 +44,7 @@ public:
|
||||
virtual long XYToPosition(long x, long y) const = 0;
|
||||
virtual bool PositionToXY(long pos, long *x, long *y) const = 0;
|
||||
virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const = 0;
|
||||
virtual QScrollArea *ScrollBarsContainer() const = 0;
|
||||
virtual QAbstractScrollArea *ScrollBarsContainer() const = 0;
|
||||
virtual void WriteText( const wxString &text ) = 0;
|
||||
virtual void SetMaxLength(unsigned long len) = 0;
|
||||
virtual void MarkDirty() = 0;
|
||||
@@ -353,9 +353,9 @@ public:
|
||||
m_edit->ensureCursorVisible();
|
||||
}
|
||||
|
||||
QScrollArea *ScrollBarsContainer() const override
|
||||
QAbstractScrollArea *ScrollBarsContainer() const override
|
||||
{
|
||||
return (QScrollArea *) m_edit;
|
||||
return static_cast<QAbstractScrollArea*>(m_edit);
|
||||
}
|
||||
|
||||
virtual void SetStyleFlags(long flags) override
|
||||
@@ -367,6 +367,9 @@ public:
|
||||
|
||||
if ( flags & wxTE_RICH || flags & wxTE_RICH2 )
|
||||
m_edit->setAcceptRichText(true);
|
||||
|
||||
if ( flags & wxTE_DONTWRAP )
|
||||
m_edit->setLineWrapMode(QTextEdit::NoWrap);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -559,7 +562,7 @@ public:
|
||||
return wxTE_HT_ON_TEXT;
|
||||
}
|
||||
|
||||
virtual QScrollArea *ScrollBarsContainer() const override
|
||||
virtual QAbstractScrollArea *ScrollBarsContainer() const override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
@@ -668,6 +671,11 @@ bool wxTextCtrl::Create(wxWindow *parent,
|
||||
if ( style & wxTE_MULTILINE )
|
||||
{
|
||||
m_qtEdit = new wxQtMultiLineEdit(new wxQtTextEdit(parent, this));
|
||||
|
||||
if ( style & wxTE_NO_VSCROLL )
|
||||
style &= ~wxVSCROLL;
|
||||
else
|
||||
style |= wxVSCROLL;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -676,16 +684,12 @@ bool wxTextCtrl::Create(wxWindow *parent,
|
||||
|
||||
m_qtEdit->SetStyleFlags(style);
|
||||
|
||||
if ( QtCreateControl( parent, id, pos, size, style, validator, name ) )
|
||||
{
|
||||
// set the initial text value without sending the event:
|
||||
// (done here as needs CreateBase called to set flags for IsMultiLine)
|
||||
ChangeValue( value );
|
||||
// set the default inner color (white), as it is replaced by PostCreation
|
||||
SetBackgroundColour( wxSystemSettingsNative::GetColour( wxSYS_COLOUR_LISTBOX ) );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
m_qtWindow = m_qtEdit->ScrollBarsContainer();
|
||||
|
||||
// set the initial text value without sending the event
|
||||
ChangeValue( value );
|
||||
|
||||
return wxTextCtrlBase::Create( parent, id, pos, size, style, validator, name );
|
||||
}
|
||||
|
||||
wxTextCtrl::~wxTextCtrl()
|
||||
@@ -910,8 +914,3 @@ QWidget *wxTextCtrl::GetHandle() const
|
||||
{
|
||||
return (QWidget *) m_qtEdit->GetHandle();
|
||||
}
|
||||
|
||||
QScrollArea *wxTextCtrl::QtGetScrollBarsContainer() const
|
||||
{
|
||||
return m_qtEdit->ScrollBarsContainer();
|
||||
}
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ bool wxToggleButton::Create(wxWindow *parent,
|
||||
// this button is toggleable and has a text label
|
||||
SetLabel( wxIsStockID( id ) ? wxGetStockLabel( id ) : label );
|
||||
|
||||
return QtCreateControl( parent, id, pos, size, style, validator, name );
|
||||
return wxToggleButtonBase::Create( parent, id, pos, size, style, validator, name );
|
||||
}
|
||||
|
||||
void wxToggleButton::SetValue(bool state)
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ wxTimePickerCtrl::Create(wxWindow *parent,
|
||||
wxQtConvertTime(wxDateTime::Now()) );
|
||||
m_qtTimeEdit->setDisplayFormat(QLocale::system().timeFormat(QLocale::ShortFormat));
|
||||
|
||||
return QtCreateControl( parent, id, pos, size, style, validator, name );
|
||||
return wxTimePickerCtrlBase::Create( parent, id, pos, size, style, validator, name );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
+6
-7
@@ -167,15 +167,14 @@ bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos,
|
||||
m_qtToolBar = new wxQtToolbar( parent, this );
|
||||
m_qtToolBar->setWindowTitle( wxQtConvertString( name ) );
|
||||
|
||||
if ( !wxControl::Create( parent, id, pos, size, style, wxDefaultValidator, name ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
SetWindowStyleFlag(style);
|
||||
|
||||
// not calling to wxWindow::Create, so do the rest of initialization:
|
||||
if (parent)
|
||||
parent->AddChild( this );
|
||||
|
||||
PostCreation();
|
||||
|
||||
return wxWindowBase::CreateBase( parent, id, pos, size, style, wxDefaultValidator, name );
|
||||
return true;
|
||||
}
|
||||
|
||||
wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord WXUNUSED(x),
|
||||
|
||||
+4
-16
@@ -29,35 +29,23 @@ wxTopLevelWindowQt::wxTopLevelWindowQt(wxWindow *parent,
|
||||
}
|
||||
|
||||
bool wxTopLevelWindowQt::Create( wxWindow *parent, wxWindowID winId,
|
||||
const wxString &title, const wxPoint &pos, const wxSize &sizeOrig,
|
||||
const wxString &title, const wxPoint &pos, const wxSize &size,
|
||||
long style, const wxString &name )
|
||||
{
|
||||
wxSize size(sizeOrig);
|
||||
if ( !size.IsFullySpecified() )
|
||||
size.SetDefaults( GetDefaultSize() );
|
||||
|
||||
wxTopLevelWindows.Append( this );
|
||||
|
||||
if (!CreateBase( parent, winId, pos, size, style, wxDefaultValidator, name ))
|
||||
if (!wxWindow::Create( parent, winId, pos, size, style, name ))
|
||||
{
|
||||
wxFAIL_MSG( wxT("wxTopLevelWindowNative creation failed") );
|
||||
return false;
|
||||
}
|
||||
|
||||
SetTitle( title );
|
||||
SetWindowStyleFlag( style );
|
||||
|
||||
if (pos != wxDefaultPosition)
|
||||
m_qtWindow->move( pos.x, pos.y );
|
||||
|
||||
m_qtWindow->resize( wxQtConvertSize( size ) );
|
||||
|
||||
// Prevent automatic deletion of Qt main window on close
|
||||
// (this should be the default, but left just fo enforce it)
|
||||
GetHandle()->setAttribute(Qt::WA_DeleteOnClose, false);
|
||||
|
||||
// not calling to wxWindow::Create, so do the rest of initialization:
|
||||
if (parent) parent->AddChild( this );
|
||||
SetTitle( title );
|
||||
SetWindowStyleFlag( style );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
+9
-3
@@ -573,14 +573,20 @@ bool wxTreeCtrl::Create(wxWindow *parent, wxWindowID id,
|
||||
const wxValidator& validator,
|
||||
const wxString& name)
|
||||
{
|
||||
m_qtWindow =
|
||||
m_qtTreeWidget = new wxQTreeWidget(parent, this);
|
||||
m_qtTreeWidget->header()->hide();
|
||||
|
||||
SetWindowStyleFlag(style);
|
||||
|
||||
Bind(wxEVT_KEY_DOWN, &wxTreeCtrl::OnKeyDown, this);
|
||||
|
||||
return QtCreateControl(parent, id, pos, size, style, validator, name);
|
||||
if ( !wxTreeCtrlBase::Create(parent, id, pos, size, style|wxHSCROLL|wxVSCROLL, validator, name) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
SetWindowStyleFlag(style);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
wxTreeCtrl::~wxTreeCtrl()
|
||||
|
||||
+254
-222
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user