Ignore:
Timestamp:
Aug 26, 2011 4:30:18 AM (13 years ago)
Author:
nanang
Message:

Re #1327:

  • Vidgui UI updates on Qt must be done in the UI thread, implemented this with Qt signal-slot mechanism.
  • VidWin::show() better be called internally by VidWin? class instead of MainWin?.
  • Fix QString to const char* issue, keeping the pointer returned by "QString::to*()::data()" won't work, the pointer actually points to a temporary data (lifetime issue).
  • Minor: cleaning up unused lines in vidgui.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/vidgui/vidwin.cpp

    r3724 r3726  
    4747VidWin::~VidWin() 
    4848{ 
     49    show(false); 
    4950    detach(); 
    50     pj_bzero(&hwnd, sizeof(hwnd)); 
    51     size_hint = QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); 
    52     destroy(true, false); 
    5351} 
    5452 
     
    5654{ 
    5755    switch(e->type()) { 
     56 
    5857    case QEvent::Resize: 
    59         { 
    60             // revert to default size hint, make it resizable 
    61             setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); 
    62             // resize now 
    63             set_size(); 
    64         } 
    65         break; 
    66     case QEvent::ParentAboutToChange: 
     58        set_size(); 
     59        break; 
     60 
     61    case QEvent::ParentChange: 
    6762        get_size(); 
    68         setFixedSize(size_hint); 
    69         break; 
    70     case QEvent::ParentChange: 
    71         { 
    72             get_size(); 
    73             /* 
     63        if (0) { 
    7464            QRect qr = rect(); 
    7565            if (qr.width() > size_hint.width()) 
     
    7767            if (qr.height() > size_hint.height()) 
    7868                size_hint.setWidth(qr.height()); 
    79             */ 
    80             setFixedSize(size_hint); 
    81             attach(); 
    8269        } 
    83         break; 
     70        setFixedSize(size_hint); 
     71        attach(); 
     72        break; 
     73 
     74    case QEvent::Show: 
     75        show(true); 
     76        // revert to default size hint, make it resizable 
     77        setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); 
     78        break; 
     79 
     80    case QEvent::Hide: 
     81        show(false); 
     82        break; 
     83 
    8484    default: 
    8585        break; 
     
    103103    orig_parent = GetParent(w); 
    104104 
     105    SetWindowLong(w, GWL_STYLE, WS_CHILD); 
    105106    SetParent(w, new_parent); 
    106     SetWindowLong(w, GWL_STYLE, WS_CHILD); 
    107     ShowWindow(w, SW_SHOWNOACTIVATE); 
    108107    TRACE_("%p new parent handle = %p", w, new_parent); 
    109108} 
     
    114113 
    115114    HWND w = (HWND)hwnd.info.win.hwnd; 
    116     ShowWindow(w, SW_HIDE); 
    117115    SetParent(w, (HWND)orig_parent); 
    118116    TRACE_("%p revert parent handle to %p", w, orig_parent); 
     
    145143    if (!hwnd.info.win.hwnd) return; 
    146144 
    147     ShowWindow(hwnd.info.win.hwnd, visible ? SW_SHOW : SW_HIDE); 
     145    HWND w = (HWND)hwnd.info.win.hwnd; 
     146    ShowWindow(w, visible ? SW_SHOW : SW_HIDE); 
    148147} 
    149148 
Note: See TracChangeset for help on using the changeset viewer.