diff options
Diffstat (limited to 'src/kvirc/ui/kvi_ipeditor.cpp')
| -rw-r--r-- | src/kvirc/ui/kvi_ipeditor.cpp | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/src/kvirc/ui/kvi_ipeditor.cpp b/src/kvirc/ui/kvi_ipeditor.cpp index 8ddcdfe9e..951b0a3af 100644 --- a/src/kvirc/ui/kvi_ipeditor.cpp +++ b/src/kvirc/ui/kvi_ipeditor.cpp @@ -21,12 +21,14 @@ // #define __KVIRC__ #include "kvi_ipeditor.h" +#include "kvi_qcstring.h" + #include <qapplication.h> #include <qlineedit.h> #include <qlabel.h> #include <qframe.h> -#include <qcstring.h> #include <ctype.h> +#include <qevent.h> // FIXME: #warning "THIS COULD GO INTO libkvioptions ?" @@ -42,7 +44,12 @@ KviIpEditor::KviIpEditor(QWidget * parent,AddressType addrType,const QString &ip } m_pEdit[7] = 0; setFrameStyle(QFrame::Sunken|QFrame::StyledPanel); + +#ifdef COMPILE_USE_QT4 + setBackgroundRole(QPalette::Base); +#else setBackgroundMode(QWidget::PaletteBase); +#endif setAddressType(addrType); @@ -60,13 +67,22 @@ void KviIpEditor::setEnabled(bool bEnabled) for(int i=0;i<8;i++) { if(m_pEdit[i])m_pEdit[i]->setEnabled(bEnabled); - if(i<7)if(m_pLabel[i]){ + if(i<7)if(m_pLabel[i]) + { // Is this the right way ? +#ifdef COMPILE_USE_QT4 + m_pLabel[i]->setBackgroundRole(isEnabled() ? QPalette::Base : QPalette::Background); +#else m_pLabel[i]->setBackgroundMode(isEnabled() ? QWidget::PaletteBase : QWidget::PaletteBackground); +#endif m_pLabel[i]->setEnabled(bEnabled); } } +#ifdef COMPILE_USE_QT4 + setBackgroundRole(isEnabled() ? QPalette::Base : QPalette::Background); +#else setBackgroundMode(isEnabled() ? QWidget::PaletteBase : QWidget::PaletteBackground); +#endif } void KviIpEditor::setAddressType(AddressType addrType) @@ -110,7 +126,7 @@ bool KviIpEditor::setAddress(const QString &ipAddr) // is valid before effectively setting the fields clear(); - QCString ip = ipAddr.ascii(); // ip addresses are digits & latin letters abcdef (IpV6) + KviQCString ip = ipAddr.ascii(); // ip addresses are digits & latin letters abcdef (IpV6) ip = ip.stripWhiteSpace(); const char * c = ip.data(); @@ -124,7 +140,7 @@ bool KviIpEditor::setAddress(const QString &ipAddr) const char *anchor = c; while(isdigit(*c))c++; if(c == anchor)return false; // Invalid empty field - QCString str(anchor,(c - anchor) + 1); + KviQCString str(anchor,(c - anchor) + 1); bool bOk; int num = str.toInt(&bOk); if(!bOk)return false; // should never happen , but just to be sure @@ -140,7 +156,7 @@ bool KviIpEditor::setAddress(const QString &ipAddr) { const char *anchor = c; while(isdigit(*c) || ((tolower(*c) >= 'a') && (tolower(*c) <= 'f')) || ((tolower(*c) >= 'A') && (tolower(*c) <= 'F')))c++; - QCString str(anchor,(c - anchor) + 1); + KviQCString str(anchor,(c - anchor) + 1); if(str.length() > 4)return false; // Too long m_pEdit[i]->setText(str.data()); if(i < 7){ @@ -203,7 +219,11 @@ void KviIpEditor::recreateChildren() m_pLabel[i]->setText(bIpV4 ? "." : ":"); m_pLabel[i]->show(); // Is this the right way ? setBackgroundMode seems to not work well +#ifdef COMPILE_USE_QT4 + m_pLabel[i]->setBackgroundRole(isEnabled() ? QPalette::Base : QPalette::Background); +#else m_pLabel[i]->setBackgroundMode(isEnabled() ? QWidget::PaletteBase : QWidget::PaletteBackground); +#endif } } // Kill the unused widgets , if any |
