wxqt: correct formatting and casting, no functional change

This commit is contained in:
Sean D'Epagnier
2016-09-12 12:24:52 -04:00
committed by Vadim Zeitlin
parent 42144b93b7
commit 169d61edb7
20 changed files with 38 additions and 36 deletions

View File

@@ -21,7 +21,7 @@ protected:
virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; virtual void DoGetSize(int *width, int *height) const wxOVERRIDE;
virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const; virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const;
QImage *GetQImage(); virtual QImage *GetQImage();
wxDECLARE_ABSTRACT_CLASS(wxScreenDCImpl); wxDECLARE_ABSTRACT_CLASS(wxScreenDCImpl);
}; };

View File

@@ -264,7 +264,7 @@ int wxBitmap::GetDepth() const
wxImage wxBitmap::ConvertToImage() const wxImage wxBitmap::ConvertToImage() const
{ {
QPixmap pixmap(M_PIXDATA); QPixmap pixmap(M_PIXDATA);
if(M_MASK && M_MASK->GetHandle()) if ( M_MASK && M_MASK->GetHandle() )
pixmap.setMask(*M_MASK->GetHandle()); pixmap.setMask(*M_MASK->GetHandle());
return ConvertImage(pixmap.toImage()); return ConvertImage(pixmap.toImage());
} }

View File

@@ -43,7 +43,7 @@ public:
private: private:
void changed( QClipboard::Mode mode) void changed( QClipboard::Mode mode)
{ {
if(mode != m_clipboard->Mode() || !m_clipboard->m_sink) if ( mode != m_clipboard->Mode() || !m_clipboard->m_sink )
return; return;
wxClipboardEvent *event = new wxClipboardEvent(wxEVT_CLIPBOARD_CHANGED); wxClipboardEvent *event = new wxClipboardEvent(wxEVT_CLIPBOARD_CHANGED);
@@ -148,7 +148,7 @@ bool wxClipboard::GetData( wxDataObject& data )
continue; continue;
wxTextDataObject *textdata = dynamic_cast<wxTextDataObject*>(&data); wxTextDataObject *textdata = dynamic_cast<wxTextDataObject*>(&data);
if(textdata) if ( textdata )
textdata->SetText(wxQtConvertString(MimeData->text())); textdata->SetText(wxQtConvertString(MimeData->text()));
else else
{ {

View File

@@ -25,7 +25,7 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data )
{ {
m_qtWindow = new wxQtColorDialog( parent, this ); m_qtWindow = new wxQtColorDialog( parent, this );
if(data) if ( data )
m_data = *data; m_data = *data;
if ( m_data.GetChooseFull() ) if ( m_data.GetChooseFull() )

View File

@@ -46,7 +46,7 @@ int wxColour::GetPixel() const
QColor wxColour::GetQColor() const QColor wxColour::GetQColor() const
{ {
if( valid ) if ( valid )
return QColor(m_red, m_green, m_blue, m_alpha); return QColor(m_red, m_green, m_blue, m_alpha);
return QColor(); return QColor();
} }

View File

@@ -62,7 +62,7 @@ wxDataFormat::wxDataFormat(const wxString &id)
wxDataFormat::wxDataFormat(const wxChar *id) wxDataFormat::wxDataFormat(const wxChar *id)
{ {
m_MimeType = (wxString)id; m_MimeType = id;
} }
wxDataFormat::wxDataFormat(const QString &id) wxDataFormat::wxDataFormat(const QString &id)
@@ -72,7 +72,7 @@ wxDataFormat::wxDataFormat(const QString &id)
void wxDataFormat::SetId( const wxChar *id ) void wxDataFormat::SetId( const wxChar *id )
{ {
m_MimeType = (wxString)id; m_MimeType = id;
} }
void wxDataFormat::SetId( const wxString& id ) void wxDataFormat::SetId( const wxString& id )

View File

@@ -652,7 +652,7 @@ void wxQtDCImpl::DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
m_qtPainter->setBackground(savedBrush); m_qtPainter->setBackground(savedBrush);
m_qtPainter->setPen(savedPen); m_qtPainter->setPen(savedPen);
} else { } else {
if(useMask && bmp.GetMask() && bmp.GetMask()->GetHandle()) if ( useMask && bmp.GetMask() && bmp.GetMask()->GetHandle() )
pix.setMask(*bmp.GetMask()->GetHandle()); pix.setMask(*bmp.GetMask()->GetHandle());
m_qtPainter->drawPixmap(x, y, pix); m_qtPainter->drawPixmap(x, y, pix);
} }

View File

@@ -72,7 +72,7 @@ void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap )
if ( bitmap.IsOk() && !bitmap.GetHandle()->isNull() ) { if ( bitmap.IsOk() && !bitmap.GetHandle()->isNull() ) {
QPixmap pixmap(*bitmap.GetHandle()); QPixmap pixmap(*bitmap.GetHandle());
// apply mask before converting to image // apply mask before converting to image
if(bitmap.GetMask() && bitmap.GetMask()->GetHandle()) if ( bitmap.GetMask() && bitmap.GetMask()->GetHandle() )
pixmap.setMask(*bitmap.GetMask()->GetHandle()); pixmap.setMask(*bitmap.GetMask()->GetHandle());
// create the intermediate image for the pixmap: // create the intermediate image for the pixmap:
m_qtImage = new QImage( pixmap.toImage() ); m_qtImage = new QImage( pixmap.toImage() );
@@ -87,7 +87,7 @@ void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap )
wxBitmap wxMemoryDCImpl::DoGetAsBitmap(const wxRect *subrect) const wxBitmap wxMemoryDCImpl::DoGetAsBitmap(const wxRect *subrect) const
{ {
if(!subrect) if ( !subrect )
return m_selected; return m_selected;
return m_selected.GetSubBitmap(*subrect); return m_selected.GetSubBitmap(*subrect);
} }

View File

@@ -46,7 +46,7 @@ bool wxScreenDCImpl::DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const
// defered allocation for blit // defered allocation for blit
QImage *wxScreenDCImpl::GetQImage() QImage *wxScreenDCImpl::GetQImage()
{ {
if(!m_qtImage) if ( !m_qtImage )
m_qtImage = new QImage(QApplication::primaryScreen()->grabWindow(QApplication::desktop()->winId()).toImage()); m_qtImage = new QImage(QApplication::primaryScreen()->grabWindow(QApplication::desktop()->winId()).toImage());
return m_qtImage; return m_qtImage;
} }

View File

@@ -70,7 +70,7 @@ int wxDialog::ShowModal()
wxCHECK_MSG( GetHandle() != NULL, -1, "Invalid dialog" ); wxCHECK_MSG( GetHandle() != NULL, -1, "Invalid dialog" );
bool ret = GetDialogHandle()->exec(); bool ret = GetDialogHandle()->exec();
if(GetReturnCode() == 0) if ( GetReturnCode() == 0 )
return ret ? wxID_OK : wxID_CANCEL; return ret ? wxID_OK : wxID_CANCEL;
return GetReturnCode(); return GetReturnCode();
} }

View File

@@ -133,7 +133,7 @@ int wxQtEventLoopBase::DispatchTimeout(unsigned long timeout)
void wxQtEventLoopBase::WakeUp() void wxQtEventLoopBase::WakeUp()
{ {
QAbstractEventDispatcher *instance = QAbstractEventDispatcher::instance(); QAbstractEventDispatcher *instance = QAbstractEventDispatcher::instance();
if(instance) if ( instance )
instance->wakeUp(); instance->wakeUp();
} }
@@ -243,7 +243,7 @@ wxEventLoopSource *wxQtEventLoopBase::AddSourceForFD(int fd, wxEventLoopSourceHa
{ {
wxGUIAppTraits *AppTraits = dynamic_cast<wxGUIAppTraits *>(wxApp::GetTraitsIfExists()); wxGUIAppTraits *AppTraits = dynamic_cast<wxGUIAppTraits *>(wxApp::GetTraitsIfExists());
if(AppTraits) if ( AppTraits )
return AppTraits->GetEventLoopSourcesManager()->AddSourceForFD(fd, handler, flags); return AppTraits->GetEventLoopSourcesManager()->AddSourceForFD(fd, handler, flags);
return NULL; return NULL;

View File

@@ -122,7 +122,7 @@ wxString wxFileDialog::GetFilename() const
{ {
wxArrayString filenames; wxArrayString filenames;
GetFilenames(filenames); GetFilenames(filenames);
if(filenames.size() == 0) if ( filenames.size() == 0 )
return ""; return "";
return filenames[0]; return filenames[0];

View File

@@ -484,7 +484,7 @@ bool wxGLCanvas::ConvertWXAttrsToQtGL(const int *wxattrs, QGLFormat &format)
} }
if ( !isBoolAttr ) { if ( !isBoolAttr ) {
if(!v) if ( !v )
return false; // zero parameter return false; // zero parameter
arg++; arg++;
} }

View File

@@ -301,7 +301,7 @@ bool wxListCtrl::GetItem(wxListItem& info) const
bool wxListCtrl::SetItem(wxListItem& info) bool wxListCtrl::SetItem(wxListItem& info)
{ {
const long id = info.GetId(); const long id = info.GetId();
if(id < 0) if ( id < 0 )
return false; return false;
QTreeWidgetItem *qitem = QtGetItem(id); QTreeWidgetItem *qitem = QtGetItem(id);
if ( qitem != NULL ) if ( qitem != NULL )

View File

@@ -96,12 +96,12 @@ wxRegion::wxRegion(const wxBitmap& bmp)
wxRegion::wxRegion(const wxBitmap& bmp, const wxColour& transp, int tolerance) wxRegion::wxRegion(const wxBitmap& bmp, const wxColour& transp, int tolerance)
{ {
if(!bmp.GetHandle()) { if ( !bmp.GetHandle() ) {
m_refData = new wxRegionRefData(); m_refData = new wxRegionRefData();
return; return;
} }
if(tolerance == 0) { if ( tolerance == 0 ) {
m_refData = new wxRegionRefData(bmp.GetHandle()->createMaskFromColor(transp.GetQColor())); m_refData = new wxRegionRefData(bmp.GetHandle()->createMaskFromColor(transp.GetQColor()));
return; return;
} }
@@ -111,15 +111,17 @@ wxRegion::wxRegion(const wxBitmap& bmp, const wxColour& transp, int tolerance)
QImage img(bmp.GetHandle()->toImage()); QImage img(bmp.GetHandle()->toImage());
int r = transp.Red(), g = transp.Green(), b = transp.Blue(); int r = transp.Red(), g = transp.Green(), b = transp.Blue();
for(int y=0; y<img.height(); y++) { for(int y=0; y<img.height(); y++)
for(int x=0; x<img.width(); x++) { {
for(int x=0; x<img.width(); x++)
{
QColor c = img.pixel(x, y); QColor c = img.pixel(x, y);
if(abs(c.red() - r) > tolerance || if ( abs(c.red() - r ) > tolerance ||
abs(c.green() - g) > tolerance || abs(c.green() - g) > tolerance ||
abs(c.blue() - b) > tolerance) { abs(c.blue() - b) > tolerance) {
int ind = y*img.width()+x; int ind = y*img.width()+x;
raw[ind>>3] |= 1<<(ind&7); raw[ind>>3] |= 1<<(ind&7);
} }
} }
} }

View File

@@ -34,10 +34,10 @@ bool wxSpinCtrlQt< T, Widget >::Create( wxWindow *parent, wxWindowID id,
const wxString& value, const wxPoint& pos, const wxSize& size, long style, const wxString& value, const wxPoint& pos, const wxSize& size, long style,
T min, T max, T initial, T inc, const wxString& name ) T min, T max, T initial, T inc, const wxString& name )
{ {
if(!(style & wxSP_ARROW_KEYS)) if ( !(style & wxSP_ARROW_KEYS) )
m_qtSpinBox->setButtonSymbols(QAbstractSpinBox::NoButtons); m_qtSpinBox->setButtonSymbols(QAbstractSpinBox::NoButtons);
if(style & wxSP_WRAP) if ( style & wxSP_WRAP )
m_qtSpinBox->setWrapping(true); m_qtSpinBox->setWrapping(true);
m_qtSpinBox->setAccelerated(true); // to match gtk behavior m_qtSpinBox->setAccelerated(true); // to match gtk behavior

View File

@@ -50,7 +50,7 @@ bool wxStatusBar::Create(wxWindow *parent, wxWindowID WXUNUSED(winid),
m_qtStatusBar = new wxQtStatusBar( parent, this ); m_qtStatusBar = new wxQtStatusBar( parent, this );
m_qtPanes = new QList < QLabel* >; m_qtPanes = new QList < QLabel* >;
if(style & wxSTB_SIZEGRIP) if ( style & wxSTB_SIZEGRIP )
m_qtStatusBar->setSizeGripEnabled(true); m_qtStatusBar->setSizeGripEnabled(true);
PostCreation(); PostCreation();
@@ -65,7 +65,7 @@ bool wxStatusBar::GetFieldRect(int i, wxRect& rect) const
wxCHECK_MSG( (i >= 0) && ((size_t)i < m_panes.GetCount()), false, wxCHECK_MSG( (i >= 0) && ((size_t)i < m_panes.GetCount()), false,
"invalid statusbar field index" ); "invalid statusbar field index" );
if(m_qtPanes->count() != m_panes.GetCount()) if ( m_qtPanes->count() != m_panes.GetCount() )
const_cast<wxStatusBar*>(this)->UpdateFields(); const_cast<wxStatusBar*>(this)->UpdateFields();
rect = wxQtConvertRect((*m_qtPanes)[i]->geometry()); rect = wxQtConvertRect((*m_qtPanes)[i]->geometry());
@@ -89,7 +89,7 @@ int wxStatusBar::GetBorderY() const
void wxStatusBar::DoUpdateStatusText(int number) void wxStatusBar::DoUpdateStatusText(int number)
{ {
if(m_qtPanes->count() != m_panes.GetCount()) if ( m_qtPanes->count() != m_panes.GetCount() )
UpdateFields(); UpdateFields();
(*m_qtPanes)[number]->setText( wxQtConvertString( m_panes[number].GetText() ) ); (*m_qtPanes)[number]->setText( wxQtConvertString( m_panes[number].GetText() ) );

View File

@@ -293,8 +293,8 @@ void wxTextCtrl::GetSelection(long* from, long* to) const
QTextCursor cursor = m_qtTextEdit->textCursor(); QTextCursor cursor = m_qtTextEdit->textCursor();
*from = cursor.selectionStart(); *from = cursor.selectionStart();
*to = cursor.selectionEnd(); *to = cursor.selectionEnd();
if(cursor.hasSelection()) if ( cursor.hasSelection() )
return; return;
} }
else // single line else // single line
{ {

View File

@@ -126,7 +126,7 @@ void wxTopLevelWindowQt::SetWindowStyleFlag( long style )
Centre(); Centre();
} }
if(!GetHandle()) if ( !GetHandle() )
return; return;
Qt::WindowFlags qtFlags = GetHandle()->windowFlags(); Qt::WindowFlags qtFlags = GetHandle()->windowFlags();

View File

@@ -243,7 +243,7 @@ bool wxWindowQt::Create( wxWindowQt * parent, wxWindowID id, const wxPoint & pos
parent->AddChild( this ); parent->AddChild( this );
wxPoint p; wxPoint p;
if(pos != wxDefaultPosition) if ( pos != wxDefaultPosition )
p = pos; p = pos;
DoMoveWindow( p.x, p.y, size.GetWidth(), size.GetHeight() ); DoMoveWindow( p.x, p.y, size.GetWidth(), size.GetHeight() );
@@ -573,7 +573,7 @@ void wxWindowQt::SetScrollbar( int orientation, int pos, int thumbvisible, int r
void wxWindowQt::SetScrollPos( int orientation, int pos, bool WXUNUSED( refresh )) void wxWindowQt::SetScrollPos( int orientation, int pos, bool WXUNUSED( refresh ))
{ {
wxScrollBar *scrollBar = QtGetScrollBar( orientation ); wxScrollBar *scrollBar = QtGetScrollBar( orientation );
if(scrollBar) if ( scrollBar )
scrollBar->SetThumbPosition( pos ); scrollBar->SetThumbPosition( pos );
} }
@@ -741,7 +741,7 @@ void wxWindowQt::SetWindowStyleFlag( long style )
// qtFrame->setFrameShadow( QFrame::Plain ); // qtFrame->setFrameShadow( QFrame::Plain );
// } // }
if(!GetHandle()) if ( !GetHandle() )
return; return;
Qt::WindowFlags qtFlags = GetHandle()->windowFlags(); Qt::WindowFlags qtFlags = GetHandle()->windowFlags();
@@ -1163,7 +1163,7 @@ bool wxWindowQt::QtHandleKeyEvent ( QWidget *WXUNUSED( handler ), QKeyEvent *eve
// qt sends keyup and keydown events for autorepeat, but this is not // qt sends keyup and keydown events for autorepeat, but this is not
// normal for wx which only sends repeated keydown events // normal for wx which only sends repeated keydown events
// discard repeated keyup events // discard repeated keyup events
if(event->isAutoRepeat() && event->type() == QEvent::KeyRelease) if ( event->isAutoRepeat() && event->type() == QEvent::KeyRelease )
return true; return true;
#if wxUSE_ACCEL #if wxUSE_ACCEL