wxqt: correct formatting and casting, no functional change
This commit is contained in:
committed by
Vadim Zeitlin
parent
42144b93b7
commit
169d61edb7
@@ -21,7 +21,7 @@ protected:
|
||||
virtual void DoGetSize(int *width, int *height) const wxOVERRIDE;
|
||||
virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const;
|
||||
|
||||
QImage *GetQImage();
|
||||
virtual QImage *GetQImage();
|
||||
|
||||
wxDECLARE_ABSTRACT_CLASS(wxScreenDCImpl);
|
||||
};
|
||||
|
@@ -264,7 +264,7 @@ int wxBitmap::GetDepth() const
|
||||
wxImage wxBitmap::ConvertToImage() const
|
||||
{
|
||||
QPixmap pixmap(M_PIXDATA);
|
||||
if(M_MASK && M_MASK->GetHandle())
|
||||
if ( M_MASK && M_MASK->GetHandle() )
|
||||
pixmap.setMask(*M_MASK->GetHandle());
|
||||
return ConvertImage(pixmap.toImage());
|
||||
}
|
||||
|
@@ -43,7 +43,7 @@ public:
|
||||
private:
|
||||
void changed( QClipboard::Mode mode)
|
||||
{
|
||||
if(mode != m_clipboard->Mode() || !m_clipboard->m_sink)
|
||||
if ( mode != m_clipboard->Mode() || !m_clipboard->m_sink )
|
||||
return;
|
||||
|
||||
wxClipboardEvent *event = new wxClipboardEvent(wxEVT_CLIPBOARD_CHANGED);
|
||||
@@ -148,7 +148,7 @@ bool wxClipboard::GetData( wxDataObject& data )
|
||||
continue;
|
||||
|
||||
wxTextDataObject *textdata = dynamic_cast<wxTextDataObject*>(&data);
|
||||
if(textdata)
|
||||
if ( textdata )
|
||||
textdata->SetText(wxQtConvertString(MimeData->text()));
|
||||
else
|
||||
{
|
||||
|
@@ -25,7 +25,7 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data )
|
||||
{
|
||||
m_qtWindow = new wxQtColorDialog( parent, this );
|
||||
|
||||
if(data)
|
||||
if ( data )
|
||||
m_data = *data;
|
||||
|
||||
if ( m_data.GetChooseFull() )
|
||||
|
@@ -46,7 +46,7 @@ int wxColour::GetPixel() const
|
||||
|
||||
QColor wxColour::GetQColor() const
|
||||
{
|
||||
if( valid )
|
||||
if ( valid )
|
||||
return QColor(m_red, m_green, m_blue, m_alpha);
|
||||
return QColor();
|
||||
}
|
||||
|
@@ -62,7 +62,7 @@ wxDataFormat::wxDataFormat(const wxString &id)
|
||||
|
||||
wxDataFormat::wxDataFormat(const wxChar *id)
|
||||
{
|
||||
m_MimeType = (wxString)id;
|
||||
m_MimeType = id;
|
||||
}
|
||||
|
||||
wxDataFormat::wxDataFormat(const QString &id)
|
||||
@@ -72,7 +72,7 @@ wxDataFormat::wxDataFormat(const QString &id)
|
||||
|
||||
void wxDataFormat::SetId( const wxChar *id )
|
||||
{
|
||||
m_MimeType = (wxString)id;
|
||||
m_MimeType = id;
|
||||
}
|
||||
|
||||
void wxDataFormat::SetId( const wxString& id )
|
||||
|
@@ -652,7 +652,7 @@ void wxQtDCImpl::DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
|
||||
m_qtPainter->setBackground(savedBrush);
|
||||
m_qtPainter->setPen(savedPen);
|
||||
} else {
|
||||
if(useMask && bmp.GetMask() && bmp.GetMask()->GetHandle())
|
||||
if ( useMask && bmp.GetMask() && bmp.GetMask()->GetHandle() )
|
||||
pix.setMask(*bmp.GetMask()->GetHandle());
|
||||
m_qtPainter->drawPixmap(x, y, pix);
|
||||
}
|
||||
|
@@ -72,7 +72,7 @@ void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap )
|
||||
if ( bitmap.IsOk() && !bitmap.GetHandle()->isNull() ) {
|
||||
QPixmap pixmap(*bitmap.GetHandle());
|
||||
// apply mask before converting to image
|
||||
if(bitmap.GetMask() && bitmap.GetMask()->GetHandle())
|
||||
if ( bitmap.GetMask() && bitmap.GetMask()->GetHandle() )
|
||||
pixmap.setMask(*bitmap.GetMask()->GetHandle());
|
||||
// create the intermediate image for the pixmap:
|
||||
m_qtImage = new QImage( pixmap.toImage() );
|
||||
@@ -87,7 +87,7 @@ void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap )
|
||||
|
||||
wxBitmap wxMemoryDCImpl::DoGetAsBitmap(const wxRect *subrect) const
|
||||
{
|
||||
if(!subrect)
|
||||
if ( !subrect )
|
||||
return m_selected;
|
||||
return m_selected.GetSubBitmap(*subrect);
|
||||
}
|
||||
|
@@ -46,7 +46,7 @@ bool wxScreenDCImpl::DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const
|
||||
// defered allocation for blit
|
||||
QImage *wxScreenDCImpl::GetQImage()
|
||||
{
|
||||
if(!m_qtImage)
|
||||
if ( !m_qtImage )
|
||||
m_qtImage = new QImage(QApplication::primaryScreen()->grabWindow(QApplication::desktop()->winId()).toImage());
|
||||
return m_qtImage;
|
||||
}
|
||||
|
@@ -70,7 +70,7 @@ int wxDialog::ShowModal()
|
||||
wxCHECK_MSG( GetHandle() != NULL, -1, "Invalid dialog" );
|
||||
|
||||
bool ret = GetDialogHandle()->exec();
|
||||
if(GetReturnCode() == 0)
|
||||
if ( GetReturnCode() == 0 )
|
||||
return ret ? wxID_OK : wxID_CANCEL;
|
||||
return GetReturnCode();
|
||||
}
|
||||
|
@@ -133,7 +133,7 @@ int wxQtEventLoopBase::DispatchTimeout(unsigned long timeout)
|
||||
void wxQtEventLoopBase::WakeUp()
|
||||
{
|
||||
QAbstractEventDispatcher *instance = QAbstractEventDispatcher::instance();
|
||||
if(instance)
|
||||
if ( instance )
|
||||
instance->wakeUp();
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ wxEventLoopSource *wxQtEventLoopBase::AddSourceForFD(int fd, wxEventLoopSourceHa
|
||||
{
|
||||
wxGUIAppTraits *AppTraits = dynamic_cast<wxGUIAppTraits *>(wxApp::GetTraitsIfExists());
|
||||
|
||||
if(AppTraits)
|
||||
if ( AppTraits )
|
||||
return AppTraits->GetEventLoopSourcesManager()->AddSourceForFD(fd, handler, flags);
|
||||
|
||||
return NULL;
|
||||
|
@@ -122,7 +122,7 @@ wxString wxFileDialog::GetFilename() const
|
||||
{
|
||||
wxArrayString filenames;
|
||||
GetFilenames(filenames);
|
||||
if(filenames.size() == 0)
|
||||
if ( filenames.size() == 0 )
|
||||
return "";
|
||||
|
||||
return filenames[0];
|
||||
|
@@ -484,7 +484,7 @@ bool wxGLCanvas::ConvertWXAttrsToQtGL(const int *wxattrs, QGLFormat &format)
|
||||
}
|
||||
|
||||
if ( !isBoolAttr ) {
|
||||
if(!v)
|
||||
if ( !v )
|
||||
return false; // zero parameter
|
||||
arg++;
|
||||
}
|
||||
|
@@ -301,7 +301,7 @@ bool wxListCtrl::GetItem(wxListItem& info) const
|
||||
bool wxListCtrl::SetItem(wxListItem& info)
|
||||
{
|
||||
const long id = info.GetId();
|
||||
if(id < 0)
|
||||
if ( id < 0 )
|
||||
return false;
|
||||
QTreeWidgetItem *qitem = QtGetItem(id);
|
||||
if ( qitem != NULL )
|
||||
|
@@ -96,12 +96,12 @@ wxRegion::wxRegion(const wxBitmap& bmp)
|
||||
|
||||
wxRegion::wxRegion(const wxBitmap& bmp, const wxColour& transp, int tolerance)
|
||||
{
|
||||
if(!bmp.GetHandle()) {
|
||||
if ( !bmp.GetHandle() ) {
|
||||
m_refData = new wxRegionRefData();
|
||||
return;
|
||||
}
|
||||
|
||||
if(tolerance == 0) {
|
||||
if ( tolerance == 0 ) {
|
||||
m_refData = new wxRegionRefData(bmp.GetHandle()->createMaskFromColor(transp.GetQColor()));
|
||||
return;
|
||||
}
|
||||
@@ -111,15 +111,17 @@ wxRegion::wxRegion(const wxBitmap& bmp, const wxColour& transp, int tolerance)
|
||||
|
||||
QImage img(bmp.GetHandle()->toImage());
|
||||
int r = transp.Red(), g = transp.Green(), b = transp.Blue();
|
||||
for(int y=0; y<img.height(); y++) {
|
||||
for(int x=0; x<img.width(); x++) {
|
||||
for(int y=0; y<img.height(); y++)
|
||||
{
|
||||
for(int x=0; x<img.width(); x++)
|
||||
{
|
||||
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.blue() - b) > tolerance) {
|
||||
int ind = y*img.width()+x;
|
||||
raw[ind>>3] |= 1<<(ind&7);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -34,10 +34,10 @@ bool wxSpinCtrlQt< T, Widget >::Create( wxWindow *parent, wxWindowID id,
|
||||
const wxString& value, const wxPoint& pos, const wxSize& size, long style,
|
||||
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);
|
||||
|
||||
if(style & wxSP_WRAP)
|
||||
if ( style & wxSP_WRAP )
|
||||
m_qtSpinBox->setWrapping(true);
|
||||
|
||||
m_qtSpinBox->setAccelerated(true); // to match gtk behavior
|
||||
|
@@ -50,7 +50,7 @@ bool wxStatusBar::Create(wxWindow *parent, wxWindowID WXUNUSED(winid),
|
||||
m_qtStatusBar = new wxQtStatusBar( parent, this );
|
||||
m_qtPanes = new QList < QLabel* >;
|
||||
|
||||
if(style & wxSTB_SIZEGRIP)
|
||||
if ( style & wxSTB_SIZEGRIP )
|
||||
m_qtStatusBar->setSizeGripEnabled(true);
|
||||
|
||||
PostCreation();
|
||||
@@ -65,7 +65,7 @@ bool wxStatusBar::GetFieldRect(int i, wxRect& rect) const
|
||||
wxCHECK_MSG( (i >= 0) && ((size_t)i < m_panes.GetCount()), false,
|
||||
"invalid statusbar field index" );
|
||||
|
||||
if(m_qtPanes->count() != m_panes.GetCount())
|
||||
if ( m_qtPanes->count() != m_panes.GetCount() )
|
||||
const_cast<wxStatusBar*>(this)->UpdateFields();
|
||||
|
||||
rect = wxQtConvertRect((*m_qtPanes)[i]->geometry());
|
||||
@@ -89,7 +89,7 @@ int wxStatusBar::GetBorderY() const
|
||||
|
||||
void wxStatusBar::DoUpdateStatusText(int number)
|
||||
{
|
||||
if(m_qtPanes->count() != m_panes.GetCount())
|
||||
if ( m_qtPanes->count() != m_panes.GetCount() )
|
||||
UpdateFields();
|
||||
|
||||
(*m_qtPanes)[number]->setText( wxQtConvertString( m_panes[number].GetText() ) );
|
||||
|
@@ -293,8 +293,8 @@ void wxTextCtrl::GetSelection(long* from, long* to) const
|
||||
QTextCursor cursor = m_qtTextEdit->textCursor();
|
||||
*from = cursor.selectionStart();
|
||||
*to = cursor.selectionEnd();
|
||||
if(cursor.hasSelection())
|
||||
return;
|
||||
if ( cursor.hasSelection() )
|
||||
return;
|
||||
}
|
||||
else // single line
|
||||
{
|
||||
|
@@ -126,7 +126,7 @@ void wxTopLevelWindowQt::SetWindowStyleFlag( long style )
|
||||
Centre();
|
||||
}
|
||||
|
||||
if(!GetHandle())
|
||||
if ( !GetHandle() )
|
||||
return;
|
||||
|
||||
Qt::WindowFlags qtFlags = GetHandle()->windowFlags();
|
||||
|
@@ -243,7 +243,7 @@ bool wxWindowQt::Create( wxWindowQt * parent, wxWindowID id, const wxPoint & pos
|
||||
parent->AddChild( this );
|
||||
|
||||
wxPoint p;
|
||||
if(pos != wxDefaultPosition)
|
||||
if ( pos != wxDefaultPosition )
|
||||
p = pos;
|
||||
|
||||
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 ))
|
||||
{
|
||||
wxScrollBar *scrollBar = QtGetScrollBar( orientation );
|
||||
if(scrollBar)
|
||||
if ( scrollBar )
|
||||
scrollBar->SetThumbPosition( pos );
|
||||
}
|
||||
|
||||
@@ -741,7 +741,7 @@ void wxWindowQt::SetWindowStyleFlag( long style )
|
||||
// qtFrame->setFrameShadow( QFrame::Plain );
|
||||
// }
|
||||
|
||||
if(!GetHandle())
|
||||
if ( !GetHandle() )
|
||||
return;
|
||||
|
||||
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
|
||||
// normal for wx which only sends repeated keydown events
|
||||
// discard repeated keyup events
|
||||
if(event->isAutoRepeat() && event->type() == QEvent::KeyRelease)
|
||||
if ( event->isAutoRepeat() && event->type() == QEvent::KeyRelease )
|
||||
return true;
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
|
Reference in New Issue
Block a user