Changeset 8 for trunk/src/widgets


Ignore:
Timestamp:
Nov 16, 2005, 8:36:46 PM (20 years ago)
Author:
dmik
Message:

Transferred Qt for OS/2 version 3.3.1-rc5 sources from the CVS

Location:
trunk/src/widgets
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/widgets/qdockwindow.cpp

    r7 r8  
    391391    timer = new QTimer( this );
    392392    connect( timer, SIGNAL( timeout() ), this, SLOT( minimize() ) );
    393 #ifdef Q_WS_WIN
     393#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    394394    setCursor( SizeAllCursor );
    395395#endif
  • trunk/src/widgets/qlabel.cpp

    r7 r8  
    280280      ( ( textformat == AutoText ) && QStyleSheet::mightBeRichText(ltext) ) );
    281281#else
    282     bool useRichText = TRUE;
     282    bool useRichText = FALSE;
    283283#endif
    284284#ifndef QT_NO_ACCEL
     
    711711
    712712        if ( x + w < cr.right() )
    713             reg = reg.unite( QRect( x + w, cr.y(),  cr.right() - x - w, cr.height() ) );
     713            reg = reg.unite( QRect( x + w, cr.y(),  cr.right() - x - w + 1, cr.height() ) );
    714714        if ( y + h < cr.bottom() )
    715             reg = reg.unite( QRect( cr.x(), y +  h, cr.width(), cr.bottom() - y - h ) );
     715            reg = reg.unite( QRect( cr.x(), y +  h, cr.width(), cr.bottom() - y - h + 1 ) );
    716716
    717717        erase( reg );
  • trunk/src/widgets/qlineedit.cpp

    r7 r8  
    13791379            case Key_Left:
    13801380            case Key_Right:
    1381 #if defined (Q_WS_WIN)
     1381#if defined (Q_WS_WIN) || (defined (Q_WS_PM) && !defined (QT_NO_CLIPBOARD))
    13821382            case Key_Insert:
    13831383            case Key_Delete:
     
    16361636            }
    16371637            break;
    1638 #if defined (Q_WS_WIN)
     1638#if defined (Q_WS_WIN) || defined (Q_WS_PM)
    16391639        case Key_Insert:
    16401640            copy();
     
    17131713        case Key_Delete:
    17141714            if ( !d->readOnly ) {
    1715 #if defined (Q_WS_WIN)
     1715#if defined (Q_WS_WIN) || (defined (Q_WS_PM) && !defined (QT_NO_CLIPBOARD))
    17161716                if ( e->state() & ShiftButton ) {
    17171717                    cut();
     
    17221722            }
    17231723            break;
    1724 #if defined (Q_WS_WIN)
     1724#if defined (Q_WS_WIN) || (defined (Q_WS_PM) && !defined (QT_NO_CLIPBOARD))
    17251725        case Key_Insert:
    17261726            if ( !d->readOnly && e->state() & ShiftButton )
  • trunk/src/widgets/qpopupmenu.cpp

    r7 r8  
    15091509        itemh = sz.height();
    15101510
    1511         if ( ncols > 1 && y + itemh > contentsRect().bottom() ) {
    1512             if ( y < contentsRect().bottom() ) {
    1513                 QRect rect(x, y, itemw, contentsRect().bottom() - y);
     1511        if ( ncols > 1 && y + itemh - 1 > contentsRect().bottom() ) {
     1512            if ( y <= contentsRect().bottom() ) {
     1513                QRect rect(x, y, itemw, contentsRect().bottom() - y + 1);
    15141514                if(!p->hasClipping() || p->clipRegion().contains(rect)) {
    15151515                    flags = QStyle::Style_Default;
     
    15281528        ++row;
    15291529    }
    1530     if ( y < contentsRect().bottom() ) {
    1531         QRect rect(x, y, itemw, contentsRect().bottom() - y);
     1530    if ( y <= contentsRect().bottom() ) {
     1531        QRect rect(x, y, itemw, contentsRect().bottom() - y + 1);
    15321532        if(!p->hasClipping() || p->clipRegion().contains(rect)) {
    15331533            flags = QStyle::Style_Default;
     
    16761676                actSig( mi->id(), b);
    16771677            }
     1678#endif
     1679#if defined(Q_WS_PM)
     1680#ifndef QT_NO_WHATSTHIS
     1681            else
     1682#endif
     1683//@@TODO (dmik): we need to play a sound when a disabled item is activated
     1684//  to conform to the OS/2 CUA. Btw, should'n it be supported by QAccessibility
     1685//  globally in Qt?
     1686                WinAlarm( HWND_DESKTOP, WA_ERROR );
    16781687#endif
    16791688        } else  if ( popup ) {
     
    19191928#endif
    19201929            mi = mitems->at( actItem );
    1921             if ( !mi->isEnabled() && !b )
     1930            if ( !mi->isEnabled() && !b ) {
     1931#if defined(Q_WS_PM)
     1932//@@TODO (dmik): we need to play a sound when a disabled item is activated
     1933//  to conform to the OS/2 CUA. Btw, should'n it be supported by QAccessibility
     1934//  globally in Qt?
     1935                WinAlarm( HWND_DESKTOP, WA_ERROR );
     1936#endif
    19221937                break;
     1938            }
    19231939            popup = mi->popup();
    19241940            if ( popup ) {
     
    20092025                popup->setFirstItemActive();
    20102026            } else {
     2027#if !defined(Q_WS_PM) // do it later, only in case of item activation
    20112028                byeMenuBar();
     2029#endif
    20122030#ifndef QT_NO_WHATSTHIS
    20132031                bool b = QWhatsThis::inWhatsThisMode();
     
    20162034#endif
    20172035                if ( mi->isEnabledAndVisible() || b ) {
     2036#if defined(Q_WS_PM)
     2037                    byeMenuBar();
     2038#endif
    20182039                    active_popup_menu = this;
    20192040                    QGuardedPtr<QSignal> signal = mi->signal();
     
    20232044                    active_popup_menu = 0;
    20242045                }
     2046#if defined(Q_WS_PM)
     2047//@@TODO (dmik): we need to play a sound when the disabled item is activated
     2048//  to conform to the OS/2 CUA. Btw, should'n it be supported by QAccessibility
     2049//  globally in Qt?
     2050                else
     2051                    WinAlarm( HWND_DESKTOP, WA_ERROR );
     2052#endif
    20252053            }
    20262054        } else if ( clashCount > 1 ) { // Clashes, highlight next...
  • trunk/src/widgets/qscrollview.cpp

    r7 r8  
    579579
    580580QScrollView::QScrollView( QWidget *parent, const char *name, WFlags f ) :
    581     QFrame( parent, name, f & (~WStaticContents) & (~WResizeNoErase) )
    582 {
    583     WFlags flags = WResizeNoErase | (f&WPaintClever) | (f&WRepaintNoErase) | (f&WStaticContents);
     581    QFrame( parent, name, f & (~WStaticContents) & (~WResizeNoErase) & (~WRepaintNoErase) )
     582{
     583    WFlags flags = (f&WResizeNoErase) | (f&WPaintClever) | (f&WRepaintNoErase) | (f&WStaticContents);
    584584    d = new QScrollViewData( this, flags );
    585585
  • trunk/src/widgets/qsplitter.cpp

    r7 r8  
    507507{
    508508    QPainter paint( this );
    509     paint.setPen( gray );
     509    paint.setPen( NoPen );
    510510    paint.setBrush( gray );
    511511    paint.setRasterOp( XorROP );
     
    513513    const int rBord = 3; // customizable?
    514514    int hw = handleWidth();
     515
     516    int p1, p2, op1, op2, tmp;
     517    if ( p >= 0 ) {
     518        p1 = p + hw / 2 - rBord;
     519        p2 = p1 + 2 * rBord - 1;
     520    }
     521    if ( opaqueOldPos >= 0 ) {
     522        op1 = opaqueOldPos + hw / 2 - rBord;
     523        op2 = op1 + 2 * rBord - 1;
     524        // exclude overlapping area to avoid flicker
     525        if ( p >= 0 ) {
     526            if ( p2 >= op1 && p2 <= op2 ) {
     527                tmp = op1;
     528                op1 = p2 + 1;
     529                p2 = tmp - 1;
     530            } else if ( p1 >= op1 && p1 <= op2 ) {
     531                tmp = op2;
     532                op2 = p1 - 1;
     533                p1 = tmp + 1;
     534            }
     535        }
     536    }
    515537    if ( orient == Horizontal ) {
    516538        if ( opaqueOldPos >= 0 )
    517             paint.drawRect( opaqueOldPos + hw / 2 - rBord, r.y(),
    518                             2 * rBord, r.height() );
     539            paint.drawRect( op1, r.y(), op2 - op1 + 1, r.height() );
    519540        if ( p >= 0 )
    520             paint.drawRect( p + hw / 2 - rBord, r.y(), 2 * rBord, r.height() );
     541            paint.drawRect( p1, r.y(), p2 - p1 + 1, r.height() );
    521542    } else {
    522543        if ( opaqueOldPos >= 0 )
    523             paint.drawRect( r.x(), opaqueOldPos + hw / 2 - rBord,
    524                             r.width(), 2 * rBord );
     544            paint.drawRect( r.x(), op1, r.width(), op2 - op1 + 1 );
    525545        if ( p >= 0 )
    526             paint.drawRect( r.x(), p + hw / 2 - rBord, r.width(), 2 * rBord );
     546            paint.drawRect( r.x(), p1, r.width(), p2 - p1 + 1 );
    527547    }
    528548    opaqueOldPos = p;
  • trunk/src/widgets/qtextedit.cpp

    r7 r8  
    11621162            case Key_Home:
    11631163            case Key_End:
    1164 #if defined (Q_WS_WIN)
     1164#if defined (Q_WS_WIN) || defined (Q_WS_PM)
    11651165            case Key_Insert:
    11661166            case Key_Delete:
     
    11721172        } else {
    11731173            switch ( ke->key() ) {
    1174 #if defined (Q_WS_WIN)
     1174#if defined (Q_WS_WIN) || defined (Q_WS_PM)
    11751175            case Key_Insert:
    11761176                ke->accept();
     
    12761276        break;
    12771277    case Key_Delete:
    1278 #if defined (Q_WS_WIN)
     1278#if defined (Q_WS_WIN) || defined (Q_WS_PM)
    12791279        if ( e->state() & ShiftButton ) {
    12801280            cut();
     
    12941294        if ( e->state() & ShiftButton )
    12951295            paste();
    1296 #if defined (Q_WS_WIN)
     1296#if defined (Q_WS_WIN) || defined (Q_WS_PM)
    12971297        else if ( e->state() & ControlButton )
    12981298            copy();
     
    13021302        break;
    13031303    case Key_Backspace:
    1304 #if defined (Q_WS_WIN)
     1304#if defined (Q_WS_WIN) || defined (Q_WS_PM)
    13051305        if ( e->state() & AltButton ) {
    13061306            if (e->state() & ControlButton ) {
     
    15171517                    doKeyboardAction( ActionKill );
    15181518                    break;
    1519 #if defined(Q_WS_WIN)
     1519#if defined(Q_WS_WIN) || defined (Q_WS_PM)
    15201520                case Key_Insert:
    15211521                    copy();
     
    24082408            emitLinkClicked( u.toString( FALSE, FALSE ) );
    24092409        }
     2410#ifndef QT_NO_TEXTBROWSER
    24102411        if (::qt_cast<QTextBrowser*>(this)) { // change for 4.0
    24112412            QConnectionList *clist = receivers(
     
    24182419            }
    24192420        }
     2421#endif       
    24202422
    24212423        // emitting linkClicked() may result in that the cursor winds
     
    47244726            }
    47254727            if (!doc->focusIndicator.name.isEmpty()) {
     4728#ifndef QT_NO_TEXTBROWSER
    47264729                if (::qt_cast<QTextBrowser*>(this)) { // change for 4.0
    47274730                    QConnectionList *clist = receivers(
     
    47364739                    }
    47374740                }
     4741#endif               
    47384742            }
    47394743#ifndef QT_NO_CURSOR
     
    47494753                copy();
    47504754                break;
    4751 #ifdef Q_WS_WIN
     4755#if defined (Q_WS_WIN) || defined (Q_WS_PM)
    47524756            case Key_Insert:
    47534757                copy();
     
    50105014        }
    50115015    } else {
    5012 #if defined(Q_OS_WIN32)
     5016#if defined(Q_OS_WIN32) || defined (Q_OS_OS2)
    50135017        // Need to convert CRLF to LF
    50145018        t.replace( "\r\n", "\n" );
     
    66926696    int endLine = startLine + nLines;
    66936697
    6694     if ( startLine >= d->od->numLines )
    6695         return;
     6698    if ( startLine >= d->od->numLines ) {
     6699#if defined (Q_WS_PM)
     6700        // see below for more info
     6701        p->eraseRect( clipx, clipy, clipw, cliph );
     6702#endif
     6703        return;
     6704    }
     6705   
    66966706    if ( (startLine + nLines) > d->od->numLines )
    66976707        nLines = d->od->numLines - startLine;
     
    68426852    td->draw( p, r.x(), r.y(), r.width(), r.height(), colorGroup() );
    68436853    p->translate( 0, -(clipy - offset) );
     6854   
     6855#if defined (Q_WS_PM)
     6856    // QTextEdit has WResizeNoErase and WRepaintNoErase flags (actually applied
     6857    // to the viewport()), so we must erase areas not covered by the text doc.
     6858    // [Win32 version feels ok without this, because it doesn't actually
     6859    // fully obey WResizeNoErase and WRepaintNoErase: WM_ERASEBKGND always
     6860    // erases the background before WM_PAINT and after every resize].
     6861   
     6862    int tw = td->width();
     6863    // calculate the height the text doc will occupy starting with clipy
     6864    int th = td->height() - offset; 
     6865    if ( clipx + clipw > td->width() ) {
     6866        // erase background to the left of every line
     6867        p->eraseRect( tw, clipy, clipx + clipw - tw, th );
     6868    }
     6869    if ( cliph > th ) {
     6870        // erase background under the text doc
     6871        p->eraseRect( clipx, clipy + th, clipw, cliph - th );
     6872    }
     6873#endif
     6874   
    68446875    delete td;
    68456876}
  • trunk/src/widgets/qtitlebar.cpp

    r7 r8  
    5858#if defined(Q_WS_WIN)
    5959#include "qt_windows.h"
     60#elif defined(Q_WS_PM)
     61#include "qt_os2.h"
    6062#endif
    6163
     
    189191}
    190192
    191 #ifdef Q_WS_WIN
     193#if defined (Q_WS_WIN)
    192194extern QRgb qt_colorref2qrgb(COLORREF col);
     195#elif defined (Q_WS_PM)
     196extern QRgb qt_sysclr2qrgb( LONG sysClr );
    193197#endif
    194198
     
    196200{
    197201    QPalette pal = palette();
     202
     203#if defined (Q_WS_PM)
     204    // we always use PM system colors for titlebars (regardless of
     205    // QApplication::desktopSettingsAware()), because the simulation will
     206    // most likely produce the same color both for an active and inactive title.
     207    pal.setColor( QPalette::Active, QColorGroup::Highlight,
     208        QColor( qt_sysclr2qrgb( SYSCLR_ACTIVETITLE ) ) );
     209    pal.setColor( QPalette::Active, QColorGroup::Base,
     210        pal.active().highlight() );
     211    pal.setColor( QPalette::Active, QColorGroup::HighlightedText,
     212        QColor( qt_sysclr2qrgb( SYSCLR_ACTIVETITLETEXT ) ) );
     213    pal.setColor( QPalette::Inactive, QColorGroup::Highlight,
     214        QColor( qt_sysclr2qrgb( SYSCLR_INACTIVETITLE ) ) );
     215    pal.setColor( QPalette::Inactive, QColorGroup::Base,
     216        pal.inactive().highlight() );
     217    pal.setColor( QPalette::Inactive, QColorGroup::HighlightedText,
     218        QColor( qt_sysclr2qrgb( SYSCLR_INACTIVETITLETEXT ) ) );
     219#else
    198220
    199221    bool colorsInitialized = FALSE;
     
    239261        pal.setColor( QPalette::Inactive, QColorGroup::HighlightedText, palette().inactive().background() );
    240262    }
     263#endif // Q_WS_PM
    241264
    242265    setPalette( pal );
  • trunk/src/widgets/qtooltip.cpp

    r7 r8  
    126126    int wakeUpDelay;
    127127    QTimer  fallAsleep;
     128#ifdef Q_WS_PM
     129    QTimer  doAllowAnimation;
     130#endif   
    128131
    129132    QPtrDict<Tip> *tips;
     
    164167    connect( &wakeUp, SIGNAL(timeout()), SLOT(showTip()) );
    165168    connect( &fallAsleep, SIGNAL(timeout()), SLOT(hideTip()) );
     169#ifdef Q_WS_PM   
     170    connect( &doAllowAnimation, SIGNAL(timeout()), SLOT(allowAnimation()) );
     171#endif   
    166172    removeTimer = new QTimer( this );
    167173}
     
    589595void QTipManager::hideTip()
    590596{
     597#ifdef Q_WS_PM
     598    // OS/2 PM has a very low limit on the number of simultaneous PM timers,
     599    // so we reuse the same timer instead of creating a new one every time this
     600    // function is invoked (it can happen more frequently than once per 250 ms).
     601    doAllowAnimation.start( 250, TRUE );
     602#else
    591603    QTimer::singleShot( 250, this, SLOT(allowAnimation()) );
     604#endif   
    592605    preventAnimation = TRUE;
    593606
  • trunk/src/widgets/qwidgetresizehandler.cpp

    r7 r8  
    4545#if defined(Q_WS_WIN)
    4646#include "qt_windows.h"
     47#elif defined(Q_WS_PM)
     48#include "qt_os2.h"
    4749#endif
    4850
     
    306308            ;
    307309    } );
     310#elif defined(Q_WS_PM)
     311    QMSG qmsg;
     312    while( WinPeekMsg( 0, &qmsg, widget->winId(), WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE ) )
     313        ;
    308314#endif
    309315
Note: See TracChangeset for help on using the changeset viewer.