- Timestamp:
- Nov 6, 2007, 11:27:57 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/configure.cmd
r167 r174 50 50 Opt.!RELEASE = 1 51 51 Opt.!DLL = 1 52 Opt.!CustomDLLName = 'myqt' 52 Opt.!CustomDLLName = 'myqt' 53 53 /* optional module configuration */ 54 54 Opt.!NETWORK = 1 … … 304 304 call WriteVar G.!ConfigCache, 'Opt.!Extra.!FT2LIB.!choice' 305 305 call WriteVar G.!ConfigCache, 'Opt.!Extra.!FT2LIB.!enabled' 306 */ 306 */ 307 307 call WriteVar G.!ConfigCache, 'Opt.!QTCustomDefines' 308 308 309 309 call lineout G.!ConfigCache 310 310 … … 424 424 /* 425 425 * determine whether to setup the environment for the debug version of Qt 426 * or for the release one 426 * or for the release one 427 427 */ 428 428 call lineout G.!QtCmd, '/* determine the default DEBUG value using .qtos2config */' … … 442 442 call lineout G.!QtCmd, 'else parse arg args' 443 443 call lineout G.!QtCmd, '' 444 /* 444 /* 445 445 * setup GCC before everything else, to prevent it from possible reordering 446 446 * of some essential paths … … 479 479 * in order to appear last in PATH (to ensure that, on the contrary, paths 480 480 * to the linker and to the make tool choosen by the user are always at 481 * the beginning) 481 * the beginning) 482 482 */ 483 483 call ConfigureCompiler_GenAddPathEnv 'PATH',, … … 556 556 557 557 /* Qt library type */ 558 558 559 559 G.!Choices.0 = 2 560 560 G.!Choices.1 = 'Dynamic link library (DLL)' … … 562 562 choice = GetChoice('Select the Qt library type:', 'G.!Choices', -Opt.!DLL + 2) 563 563 Opt.!DLL = -choice + 2 564 564 565 565 OfficialBuildConfig = '' 566 566 567 567 if (Opt.!DLL == 1) then do 568 call SaySay 'You are going to build Qt as a dynamic link library. In order' 568 call SaySay 'You are going to build Qt as a dynamic link library. In order' 569 569 call SaySay 'to prevent possible DLL naming conflicts (a.k.a. DLL hell) with' 570 570 call SaySay 'the official binary distribution of Qt and with other custom' … … 583 583 leave 584 584 end 585 upperName = translate(name) 585 upperName = translate(name) 586 586 if (upperName \= '' & length(upperName) <= 8 &, 587 587 verify(upperName,'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-_') == 0 &, … … 597 597 598 598 /* Qt library debug level */ 599 599 600 600 G.!Choices.0 = 2 601 601 G.!Choices.1 = 'Release (no debug information)' … … 605 605 606 606 /* Optional Qt modules */ 607 607 608 608 G.!Choices.0 = 6 609 609 do forever … … 655 655 656 656 call WriteConfigCache 657 */ 657 */ 658 658 /* Custom Qt defines */ 659 659 660 660 if (OfficialBuildConfig == '') then do 661 661 call SaySay 'Enter a list of custom Qt defines separated by spaces' … … 665 665 Opt.!QTCustomDefines = strip(Opt.!QTCustomDefines) 666 666 end 667 667 668 668 call WriteConfigCache 669 669 670 670 /* Generate setup files for Qt */ 671 671 672 672 BasicModules = 'kernel tools widgets dialogs styles' 673 673 BasicModulesHeader =, … … 749 749 */ 750 750 ExtraConfig = strip(ExtraConfig) 751 751 752 752 ConfigHeader =, 753 753 '/* Everything */'G.!EOL||, … … 769 769 '#define QT_NO_STYLE_WINDOWSXP'G.!EOL||, 770 770 '#endif'G.!EOL 771 771 772 772 ConfigSource =, 773 773 '#include <qglobal.h>'G.!EOL||, … … 793 793 'const char *qInstallPathTranslations() { return QT_INSTALL_TRANSLATIONS + 11; }'G.!EOL||, 794 794 'const char *qInstallPathSysconf() { return 0; }'G.!EOL 795 795 796 796 call SaySay 'You have selected the following compiler configuration:' 797 797 say … … 805 805 call SaySay 'Modules : 'BasicModules OptionalModules 806 806 call SaySay 'Other features : 'OptionalConfig 807 if (Opt.!QTCustomDefines \= '') then 807 if (Opt.!QTCustomDefines \= '') then 808 808 call SaySay 'Custom defines : 'Opt.!QTCustomDefines 809 809 say … … 834 834 call lineout qmake_cache, 'sql-drivers+=' 835 835 call lineout qmake_cache, 'sql-plugins+=' 836 call lineout qmake_cache, 'styles+=windows '836 call lineout qmake_cache, 'styles+=windows warp4 motif' 837 837 call lineout qmake_cache, 'style-plugins+=' 838 838 call lineout qmake_cache, 'imageformat-plugins+=' … … 879 879 * recompiling every source when no affecting settings are changed 880 880 */ 881 881 882 882 create = \FileExists(qmodules_h) 883 883 if (\create) then create = CompareFileToVar(qmodules_h, ModulesHeader) \= 0 … … 903 903 call charout qconfig_cpp 904 904 end 905 905 906 906 call CopyFile QuotePath(G.!QTDirP)'\qmake\"Makefile.os2-g++"',, 907 907 G.!QMakeMakefile … … 944 944 call DeleteFile build_log 945 945 end 946 946 947 947 build_target = '' 948 948 … … 1174 1174 if (Opt.!Extra.!FT2LIB.!changed \== 1) then def = 'Y'; else def = '' 1175 1175 return GetYesNo("Accept the above version?", def) 1176 1176 1177 1177 /** 1178 1178 */ … … 1205 1205 if (contents > aVar) then return 1 1206 1206 return 0 1207 1207 1208 1208 CopyFile: procedure expose (Globals) 1209 1209 parse arg fileFrom, fileTo … … 1287 1287 call SysCurPos row, col 1288 1288 return 1289 1289 1290 1290 /** 1291 1291 * Displays a prompt to input a text line and returns the line entered by the … … 1309 1309 allow_empty = pos('N', mode) == 0 1310 1310 allow_cancel = pos('C', mode) > 0 1311 1311 1312 1312 line = default 1313 1313 len = length(line) … … 1324 1324 iterate 1325 1325 end 1326 1326 1327 1327 select 1328 1328 when (\extended & key == '08'x) then do … … 1405 1405 end 1406 1406 end 1407 1407 1408 1408 say 1409 1409 return line … … 1648 1648 1649 1649 parse arg stem, prompt, searchPattern, checkPath, checkVer, errPath, mode 1650 1650 1651 1651 mode = translate(mode) 1652 1652 if (pos('C', mode) > 0) then mode = 'C' … … 1654 1654 1655 1655 if (symbol('Static.!MenuSelectPath.!Recent') \= 'VAR') then 1656 Static.!MenuSelectPath.!Recent = '' 1657 1656 Static.!MenuSelectPath.!Recent = '' 1657 1658 1658 do forever 1659 1659 … … 1665 1665 choice = GetChoice(prompt, stem, default, mode) 1666 1666 call SysStemDelete stem, n 1667 1667 1668 1668 if (choice == -1) then return '' /* canceled */ 1669 1669 … … 1673 1673 '(or Esc to cancel):',, 1674 1674 Static.!MenuSelectPath.!Recent) 1675 if (path == '') then iterate /* canceled */ 1675 if (path == '') then iterate /* canceled */ 1676 1676 Static.!MenuSelectPath.!Recent = path 1677 1677 call SaySay 'Please wait...' … … 1742 1742 parse arg path 1743 1743 return Replace(path, '\', '\\') 1744 1744 1745 1745 /** 1746 1746 * Fixes the directory path by a) converting all slashes to back … … 1836 1836 say 'RC:255:CR' 1837 1837 exit 255 1838 1838 1839 1839 /** 1840 1840 * Magic log handler. … … 1845 1845 file = strip(file) 1846 1846 signal on halt name MagicLogHalt 1847 rc = 0 1847 rc = 0 1848 1848 do while (stream('STDIN', 'S') == 'READY') 1849 1849 line = linein() -
trunk/src/kernel/qapplication.cpp
r172 r174 1235 1235 else 1236 1236 style = "Windows"; // default styles for Windows 1237 #elif defined(Q_WS_PM) 1238 /// @todo (dmik) temporary, until the native style is done 1239 style = "Windows"; // default style for OS/2 1237 // this is temporarily disabled until most bugs are fixed, 1238 // see http://svn.netlabs.org/qr3/ticket/9 for details 1239 //#elif defined(Q_WS_PM) 1240 // style = "Warp4"; // default style for OS/2 1241 //#endif 1240 1242 #elif defined(Q_WS_X11) && defined(Q_OS_SOLARIS) 1241 1243 style = "CDE"; // default style for X11 on Solaris … … 1253 1255 if ( !app_style && // platform default style not available, try alternatives 1254 1256 !(app_style = QStyleFactory::create( "Windows" ) ) && 1257 // !(app_style = QStyleFactory::create( "Warp4" ) ) && 1255 1258 !(app_style = QStyleFactory::create( "Platinum" ) ) && 1256 1259 !(app_style = QStyleFactory::create( "MotifPlus" ) ) && … … 1370 1373 The string must be one of the QStyleFactory::keys(), typically one 1371 1374 of "windows", "motif", "cde", "motifplus", "platinum", "sgi" and 1372 "compact". Depending on the platform, "windowsxp", " aqua" or1375 "compact". Depending on the platform, "windowsxp", "warp4", "aqua" or 1373 1376 "macintosh" may be available. 1374 1377 -
trunk/src/kernel/qapplication_pm.cpp
r171 r174 131 131 const QPixmap *, int, int, int ); 132 132 133 Q_EXPORT 133 134 QRgb qt_sysclr2qrgb( LONG sysClr ) 134 135 { … … 139 140 } 140 141 141 QFont qt_sysfont2qfont( const PSZ scope ) { 142 static 143 QFont qt_sysfont2qfont( const PSZ scope ) 144 { 142 145 static const PSZ app = "PM_SystemFonts"; 143 static const PSZ def = " 8.Helv";146 static const PSZ def = "10.System Proportional"; 144 147 ULONG keyLen = 0; 145 QFont f( " Helv", 8);148 QFont f( "System Proportional", 10 ); 146 149 147 150 if ( PrfQueryProfileSize( HINI_USERPROFILE, app, scope, &keyLen ) && keyLen ) { … … 369 372 // Do the font settings 370 373 374 #ifndef QT_PM_NO_DEFAULTFONT_OVERRIDE 371 375 QFont windowFont = qt_sysfont2qfont( "WindowText" ); 376 #else 377 QFont windowFont = qt_sysfont2qfont( "DefaultFont" ); 378 #endif 372 379 QFont menuFont = qt_sysfont2qfont( "Menus" ); 373 380 QFont iconFont = qt_sysfont2qfont( "IconText" ); … … 440 447 *qt_std_pal = pal; 441 448 442 // a special palette for menus 443 acg.setColor( QColorGroup::Highlight, 449 // special palettes 450 QColorGroup scg; 451 452 // menus 453 scg = acg; 454 scg.setColor( QColorGroup::Background, 455 QColor( qt_sysclr2qrgb( SYSCLR_MENU ) ) ); 456 scg.setColor( QColorGroup::Highlight, 444 457 QColor( qt_sysclr2qrgb( SYSCLR_MENUHILITEBGND ) ) ); 445 acg.setColor( QColorGroup::HighlightedText,458 scg.setColor( QColorGroup::HighlightedText, 446 459 QColor( qt_sysclr2qrgb( SYSCLR_MENUHILITE ) ) ); 447 QApplication::setPalette( QPalette( acg, dcg, icg ), TRUE, "QPopupMenu"); 448 QApplication::setPalette( QPalette( acg, dcg, icg ), TRUE, "QMenuBar"); 460 pal.setActive( scg ); 461 pal.setInactive( scg ); 462 QApplication::setPalette( pal, TRUE, "QPopupMenu" ); 463 QApplication::setPalette( pal, TRUE, "QMenuBar" ); 464 465 // static widget texts 466 scg = acg; 467 QColor staticTextCol( qt_sysclr2qrgb( SYSCLR_WINDOWSTATICTEXT ) ); 468 scg.setColor( QColorGroup::Foreground, staticTextCol ); 469 scg.setColor( QColorGroup::Text, staticTextCol ); 470 pal.setActive( scg ); 471 pal.setInactive( scg ); 472 QApplication::setPalette( pal, TRUE, "QLabel" ); 473 QApplication::setPalette( pal, TRUE, "QGroupBox" ); 449 474 } 450 475 … … 457 482 { 458 483 public: 459 static bool &installed() { return QtOS2SysXcptMainHandler::installed; } 484 static bool &installed() { return QtOS2SysXcptMainHandler::installed; } 460 485 static ERR &libcHandler() { return QtOS2SysXcptMainHandler::libcHandler; } 461 486 static ERR handler() { return QtOS2SysXcptMainHandler::handler; } … … 486 511 DosGetInfoBlocks( &ptib, NULL ); 487 512 Q_ASSERT( ptib && ptib->tib_ptib2 ); 488 513 489 514 if ( ptib && ptib->tib_ptib2 ) { 490 // must be called only on the main (first) thread 515 // must be called only on the main (first) thread 491 516 Q_ASSERT( ptib->tib_ptib2->tib2_ultid == 1 ); 492 517 // also make sure that QtOS2SysXcptMainHandler was not already … … 551 576 // default font 552 577 if ( !qt_app_has_font ) 553 QApplication::setFont( QFont( "Helv", 8) );578 QApplication::setFont( QFont( "System Proportional", 10 ) ); 554 579 555 580 // QFont::locale_init(); ### Uncomment when it does something on OS/2 … … 590 615 591 616 #if !defined(QT_OS2_NO_SYSEXCEPTIONS) 592 // remove the exception handler if it was installed in qt_init() 617 // remove the exception handler if it was installed in qt_init() 593 618 PTIB ptib = NULL; 594 619 DosGetInfoBlocks( &ptib, NULL ); 595 620 Q_ASSERT( ptib && ptib->tib_ptib2 ); 596 621 597 622 if ( ptib && ptib->tib_ptib2 ) { 598 // must be called only on the main (first) thread 623 // must be called only on the main (first) thread 599 624 Q_ASSERT( ptib->tib_ptib2->tib2_ultid == 1 ); 600 625 // also make sure the handler was really installed by qt_init() … … 1003 1028 enum { 1004 1029 // some undocumented messages (they have the WM_U_ prefix for clarity) 1005 1030 1006 1031 // sent to hwnd that has been entered to by a mouse pointer. 1007 1032 // FID_CLIENT also receives enter messages of its WC_FRAME. … … 2064 2089 return; 2065 2090 } 2066 2091 2067 2092 // find the modal's group leader 2068 2093 QWidget *mgl = modal->parentWidget(); … … 2548 2573 #endif 2549 2574 if ( curWin != winId() ) { // new current window 2550 /// @todo (dmik) 2575 /// @todo (dmik) 2551 2576 // add CS_HITTEST to our window classes and handle WM_HITTEST, 2552 2577 // otherwise disabled windows will not get mouse events? … … 2764 2789 // Alt+letter shortcuts in the NLS keyboard mode together with Alt+NLS_letter 2765 2790 // shortcuts (nice feature imho). Note that Alt+NLS_letter shortcuts are 2766 // correctly processed in any case. 2791 // correctly processed in any case. 2767 2792 2768 2793 // cache table to store Qt::Key_... values for 256 hardware scancodes -
trunk/src/kernel/qfont_pm.cpp
r8 r174 58 58 { 59 59 switch( styleHint ) { 60 case QFont::Times: 61 return QString::fromLatin1("Times New Roman"); 62 case QFont::Courier: 63 return QString::fromLatin1("Courier"); 64 case QFont::Decorative: 65 return QString::fromLatin1("Times New Roman"); 66 case QFont::Helvetica: 67 return QString::fromLatin1("Helvetica"); 68 case QFont::System: 69 //@@TODO (dmik): check for OS/2 ver and return the appropriate system font 70 // (i.e. "System Proportional" for ver <= Warp 3) 71 return QString::fromLatin1("WarpSans"); 72 default: 60 case QFont::Times: 61 return QString::fromLatin1( "Times New Roman" ); 62 case QFont::Courier: 63 return QString::fromLatin1( "Courier" ); 64 case QFont::Decorative: 65 return QString::fromLatin1( "Times New Roman" ); 66 case QFont::Helvetica: 67 return QString::fromLatin1( "Helvetica" ); 68 case QFont::System: { 69 #ifndef QT_PM_NO_DEFAULTFONT_OVERRIDE 70 static ULONG ver[2] = {0}; 71 if ( ver[0] == ver[1] == 0 ) { 72 DosQuerySysInfo( QSV_VERSION_MAJOR, QSV_VERSION_MINOR, 73 &ver, sizeof(ver) ); 74 } 75 if ( ver[0] == 20 && ver[1] >= 40 ) 76 return QString::fromLatin1( "WarpSans" ); 77 else 78 #endif 79 return QString::fromLatin1( "System Proportional" ); 80 } 81 default: 73 82 // the family to be used when no StyleHint is set (in accordance 74 83 // with the font matching algorithm stated in QFont docs) 75 return QString::fromLatin1( "Helvetica");84 return QString::fromLatin1( "Helvetica" ); 76 85 } 77 86 //@@TODO (dmik): should we also add default font substitutions to … … 79 88 } 80 89 81 //@@TODO (dmik): remove82 //extern HDC shared_dc; // common dc for all fonts83 84 //@@TODO (dmik): remove?85 //// ### maybe move to qapplication_win86 //QFont qt_LOGFONTtoQFont(LOGFONT& lf, bool /*scale*/)87 //{88 // QString family = QT_WA_INLINE( QString::fromUcs2((ushort*)lf.lfFaceName),89 // QString::fromLocal8Bit((char*)lf.lfFaceName) );90 // QFont qf(family);91 // qf.setItalic(lf.lfItalic);92 // if (lf.lfWeight != FW_DONTCARE) {93 // int weight;94 // if ( lf.lfWeight < 400 )95 // weight = QFont::Light;96 // else if ( lf.lfWeight < 600 )97 // weight = QFont::Normal;98 // else if ( lf.lfWeight < 700 )99 // weight = QFont::DemiBold;100 // else if ( lf.lfWeight < 800 )101 // weight = QFont::Bold;102 // else103 // weight = QFont::Black;104 // qf.setWeight(weight);105 // }106 // int lfh = QABS( lf.lfHeight );107 // Q_ASSERT(shared_dc);108 // qf.setPointSizeFloat( lfh * 72.0 / GetDeviceCaps(shared_dc,LOGPIXELSY) );109 // qf.setUnderline(FALSE);110 // qf.setOverline(FALSE);111 // qf.setStrikeOut(FALSE);112 // return qf;113 //}114 115 116 //@@TODO (dmik): need these two funcs?117 //static inline float pixelSize( const QFontDef &request, QPaintDevice *paintdevice,118 // int )119 //{120 // float pSize;121 // if ( request.pointSize != -1 ) {122 // if ( paintdevice ) {123 // pSize = request.pointSize *124 // QPaintDeviceMetrics( paintdevice ).logicalDpiY() / 720.;125 // } else {126 // LONG dpi;127 // DevQueryCaps( GpiQueryDevice( qt_display_ps() ),128 // CAPS_VERTICAL_FONT_RES, 1, &val );129 // pSize = (request.pointSize*dpi + 360) / 720;130 // }131 // } else {132 // pSize = request.pixelSize;133 // }134 // return pSize;135 //}136 //137 //static inline float pointSize( const QFontDef &fd, QPaintDevice *paintdevice,138 // int )139 //{140 // float pSize;141 // if ( fd.pointSize == -1 ) {142 // if ( paintdevice ) {143 // pSize = fd.pixelSize * 720. /144 // QPaintDeviceMetrics( paintdevice ).logicalDpiY();145 // } else {146 // LONG dpi;147 // DevQueryCaps( GpiQueryDevice( qt_display_ps() ),148 // CAPS_VERTICAL_FONT_RES, 1, &val );149 // pSize = fd.pixelSize * 72.0 / dpi;150 // }151 // } else {152 // pSize = fd.pointSize;153 // }154 // return pSize;155 //}156 157 90 /***************************************************************************** 158 91 QFont member functions … … 165 98 if ( QFontCache::instance ) 166 99 return; 167 //@@TODO (dmik): remove168 // shared_dc = CreateCompatibleDC( qt_display_dc() );169 //#if defined(QT_CHECK_RANGE)170 // if ( !shared_dc )171 // qSystemWarning( "QFont::initialize() (qfont_win.cpp, 163): couldn't create device context" );172 //#endif173 100 new QFontCache(); 174 101 … … 180 107 { 181 108 delete QFontCache::instance; 182 //@@TODO (dmik): remove183 // DeleteDC( shared_dc );184 // shared_dc = 0;185 109 } 186 110 … … 194 118 // sanity checks 195 119 if (!QFontCache::instance) 196 120 qWarning("Must construct a QApplication before a QFont"); 197 121 Q_ASSERT( script >= 0 && script < QFont::LastPrivateScript ); 198 122 #endif // QT_CHECK_STATE … … 204 128 } else { 205 129 DevQueryCaps( GpiQueryDevice( qt_display_ps() ), 206 CAPS_VERTICAL_FONT_RES, 1, (PLONG) &dpi );130 CAPS_VERTICAL_FONT_RES, 1, (PLONG) &dpi ); 207 131 } 208 132 if (req.pointSize != -1) … … 212 136 213 137 if ( ! engineData ) { 214 215 216 217 218 219 220 221 222 223 224 225 138 QFontCache::Key key( req, QFont::NoScript, (int)paintdevice ); 139 140 // look for the requested font in the engine data cache 141 engineData = QFontCache::instance->findEngineData( key ); 142 143 if ( ! engineData) { 144 // create a new one 145 engineData = new QFontEngineData; 146 QFontCache::instance->insertEngineData( key, engineData ); 147 } else { 148 engineData->ref(); 149 } 226 150 } 227 151 … … 239 163 240 164 if (!req.family.isEmpty()) { 241 242 243 244 245 246 247 248 165 family_list = QStringList::split( ',', req.family ); 166 167 // append the substitute list for each family in family_list 168 QStringList subs_list; 169 QStringList::ConstIterator it = family_list.begin(), end = family_list.end(); 170 for ( ; it != end; ++it ) 171 subs_list += QFont::substitutes( *it ); 172 family_list += subs_list; 249 173 250 174 //@@TODO (dmik): need something here? 251 252 175 // append the default fallback font for the specified script 176 // family_list << ... ; ########### 253 177 254 178 // add the family corresponding to font's styleHint 255 179 QString hintFamily = qt_pm_default_family( request.styleHint ); 256 180 if ( ! family_list.contains( hintFamily ) ) 257 181 family_list << hintFamily; 258 182 … … 262 186 // below added to the list. 263 187 264 265 266 267 268 269 270 271 188 // add the default family 189 QString defaultFamily = QApplication::font().family(); 190 if ( ! family_list.contains( defaultFamily ) ) 191 family_list << defaultFamily; 192 193 // add QFont::defaultFamily() to the list, for compatibility with 194 // previous versions 195 family_list << QApplication::font().defaultFamily(); 272 196 } 273 197 … … 277 201 QStringList::ConstIterator it = family_list.begin(), end = family_list.end(); 278 202 for ( ; ! engine && it != end; ++it ) { 279 280 281 282 283 284 285 286 287 288 289 290 203 req.family = *it; 204 205 engine = QFontDatabase::findFont( script, this, req ); 206 if ( engine ) { 207 if ( engine->type() != QFontEngine::Box ) 208 break; 209 210 if ( ! req.family.isEmpty() ) 211 engine = 0; 212 213 continue; 214 } 291 215 } 292 216 … … 343 267 QString QFont::lastResortFont() const 344 268 { 345 return QString::fromLatin1( "System Proportional");269 return QString::fromLatin1( "System Proportional" ); 346 270 } 347 271 … … 351 275 QFontMetrics member functions 352 276 *****************************************************************************/ 353 354 //@@TODO (dmik): remove355 //#define IS_TRUETYPE (QT_WA_INLINE( engine->tm.w.tmPitchAndFamily, engine->tm.a.tmPitchAndFamily ) & TMPF_TRUETYPE)356 //#define TMX engine->tm.w357 //#define TMW engine->tm.w358 //#define TMA engine->tm.a359 277 360 278 //@@TODO (dmik): do we need a separate (other than in qfont.cpp) -
trunk/src/styles/qstylefactory.cpp
r2 r174 52 52 #include "qwindowsxpstyle.h" 53 53 #endif 54 #ifndef QT_NO_STYLE_WARP4 55 #include "qwarp4style.h" 56 #endif 54 57 #ifndef QT_NO_STYLE_AQUA 55 58 #include "qaquastyle.h" … … 109 112 including "windows", "motif", "cde", "motifplus", "platinum", 110 113 "sgi" and "compact". Depending on the platform, "windowsxp", 111 " aqua" or "macintosh" may be available.114 "warp4", "aqua" or "macintosh" may be available. 112 115 */ 113 116 … … 132 135 else 133 136 #endif 137 #ifndef QT_NO_STYLE_WARP4 138 if ( style == "warp4" ) 139 ret = new QWarp4Style; 140 else 141 #endif 134 142 #ifndef QT_NO_STYLE_MOTIF 135 143 if ( style == "motif" ) … … 165 173 if ( style == "aqua" ) 166 174 ret = new QAquaStyle; 175 else 167 176 #endif 168 177 #ifndef QT_NO_STYLE_POCKETPC 169 178 if ( style == "pocketpc" ) 170 ret = new QPocketPCStyle; 179 ret = new QPocketPCStyle; 180 else 171 181 #endif 172 182 #if !defined( QT_NO_STYLE_MAC ) && defined( Q_WS_MAC ) 173 183 if( style.left(9) == "macintosh" ) 174 ret = new QMacStyle; 184 ret = new QMacStyle; 185 else 175 186 #endif 176 187 { } // Keep these here - they make the #ifdefery above work … … 216 227 if ( !list.contains( "WindowsXP" ) && QWindowsXPStyle::resolveSymbols() ) 217 228 list << "WindowsXP"; 229 #endif 230 #ifndef QT_NO_STYLE_WARP4 231 if ( !list.contains( "Warp4" ) ) 232 list << "Warp4"; 218 233 #endif 219 234 #ifndef QT_NO_STYLE_MOTIF -
trunk/src/styles/qt_styles.pri
r2 r174 12 12 13 13 contains( styles, all ) { 14 styles += mac cde motifplus sgi platinum compact interlace windows motif14 styles += mac cde motifplus sgi platinum compact interlace windows warp4 motif 15 15 } 16 16 … … 19 19 HEADERS +=$$STYLES_H/qmacstyle_mac.h 20 20 SOURCES +=$$STYLES_CPP/qmacstyle_mac.cpp 21 HEADERS *= $$STYLES_CPP/qaquastyle_p.h 22 SOURCES *= $$STYLES_CPP/qaquastyle_p.cpp 21 HEADERS *= $$STYLES_CPP/qaquastyle_p.h 22 SOURCES *= $$STYLES_CPP/qaquastyle_p.cpp 23 23 24 24 !contains( styles, windows ) { … … 31 31 #embedded|!macx-*:styles -= aqua 32 32 contains( styles, aqua ) { 33 HEADERS += $$STYLES_H/qaquastyle.h 34 SOURCES += $$STYLES_CPP/qaquastyle.cpp 35 HEADERS *= $$STYLES_CPP/qaquastyle_p.h 36 SOURCES *= $$STYLES_CPP/qaquastyle_p.cpp 33 HEADERS += $$STYLES_H/qaquastyle.h 34 SOURCES += $$STYLES_CPP/qaquastyle.cpp 35 HEADERS *= $$STYLES_CPP/qaquastyle_p.h 36 SOURCES *= $$STYLES_CPP/qaquastyle_p.cpp 37 37 38 38 !contains( styles, windows ) { … … 124 124 } 125 125 } 126 127 126 else:DEFINES += QT_NO_STYLE_POCKETPC 127 128 128 contains( styles, windows ) { 129 129 HEADERS +=$$STYLES_H/qwindowsstyle.h … … 131 131 } 132 132 else:DEFINES += QT_NO_STYLE_WINDOWS 133 134 contains( styles, warp4 ) { 135 HEADERS +=$$STYLES_H/qwarp4style.h 136 SOURCES +=$$STYLES_CPP/qwarp4style.cpp 137 } 138 else:DEFINES += QT_NO_STYLE_WARP4 133 139 134 140 contains( styles, motif ) { -
trunk/src/widgets/qcombobox.cpp
r2 r174 1339 1339 arrowRect.setHeight( QMAX( height() - (2 * arrowRect.y()), arrowRect.height() ) ); 1340 1340 1341 if ( count() && ( !editable() || arrowRect.contains( e->pos() ) ) ) { 1341 bool dropDown; 1342 int gs = style().styleHint(QStyle::SH_GUIStyle); 1343 if ( gs == QStyle::PMStyle ) 1344 dropDown = count() && arrowRect.contains( e->pos() ); 1345 else 1346 dropDown = count() && ( !editable() || arrowRect.contains( e->pos() ) ); 1347 1348 if ( dropDown ) { 1342 1349 d->arrowPressed = FALSE; 1343 1350 … … 1358 1365 QTimer::singleShot( 200, this, SLOT(internalClickTimeout())); 1359 1366 d->shortClick = TRUE; 1367 } 1368 else if ( gs == QStyle::PMStyle ) { 1369 setFocus(); 1360 1370 } 1361 1371 } -
trunk/src/widgets/qdatetimeedit.cpp
r2 r174 1081 1081 QFontMetrics fm( font() ); 1082 1082 int fw = style().pixelMetric( QStyle::PM_DefaultFrameWidth, this ); 1083 int h = QMAX( fm.lineSpacing(), 14 ) + 2; 1083 int h = QMAX( fm.lineSpacing(), 14 ); 1084 if ( style().styleHint( QStyle::SH_GUIStyle ) != QStyle::PMStyle ) 1085 h += 2; 1084 1086 int w = 2 + fm.width( '9' ) * 8 + fm.width( d->ed->separator() ) * 2 + d->controls->upRect().width() + fw * 4; 1085 1087 1086 return QSize( w, QMAX(h + fw * 2, 20) ).expandedTo( QApplication::globalStrut() );1088 return QSize( w, QMAX(h + fw * 2, 20) ).expandedTo( QApplication::globalStrut() ); 1087 1089 } 1088 1090 … … 2526 2528 QFontMetrics fm( font() ); 2527 2529 int fw = style().pixelMetric( QStyle::PM_DefaultFrameWidth, this ); 2528 int h = fm.lineSpacing() + 2; 2530 int h = fm.lineSpacing(); 2531 if ( style().styleHint( QStyle::SH_GUIStyle ) != QStyle::PMStyle ) 2532 h += 2; 2529 2533 int w = 2 + fm.width( '9' ) * 6 + fm.width( d->ed->separator() ) * 2 + 2530 2534 d->controls->upRect().width() + fw * 4; … … 2536 2540 } 2537 2541 2538 return QSize( w, QMAX(h + fw * 2, 20) ).expandedTo( QApplication::globalStrut() );2542 return QSize( w, QMAX(h + fw * 2, 20) ).expandedTo( QApplication::globalStrut() ); 2539 2543 } 2540 2544 -
trunk/src/widgets/qdial.cpp
r2 r174 261 261 p.begin( this ); 262 262 263 // note: drawing dial controls is NOT AT ALL using the QStyle drawing 264 // concept, so we have to draw the Warp4 dial here explicitly in 265 // the widget code! 266 if ( style().styleHint( QStyle::SH_GUIStyle ) == QStyle::PMStyle ) { 267 QRect rr(rect()); 268 269 // erase the background 270 QBrush br( paletteBackgroundColor() ); 271 p.setPen( QPen::NoPen ); 272 p.fillRect( rr, br ); 273 274 // centered quadratic rectangle 275 if ( rr.width() > rr.height() ) { 276 rr.setWidth( rr.height() ); 277 rr.moveBy( (width() - rr.width()) / 2, 0 ); 278 } else { 279 rr.setHeight( rr.width() ); 280 rr.moveBy( 0, (height() - rr.height()) / 2 ); 281 } 282 283 // draw the ticks ("notches") 284 if ( d->showNotches ) { 285 calcLines(); 286 p.setPen( colorGroup().foreground() ); 287 p.drawLineSegments( d->lines ); 288 } 289 290 // draw dial (circle with shadow) 291 int bigLineSize = calcBigLineSize(); 292 int dist = 6; 293 rr.setLeft( rr.left() + bigLineSize + dist ); 294 rr.setTop( rr.top() + bigLineSize + dist ); 295 rr.setRight( rr.right() - bigLineSize - dist ); 296 rr.setBottom( rr.bottom() - bigLineSize - dist ); 297 p.setPen( QPen( colorGroup().shadow(), 2) ); 298 p.drawEllipse( rr ); 299 rr.setLeft( rr.left() + 2 ); 300 rr.setTop( rr.top() + 2 ); 301 rr.setRight( rr.right() - 2 ); 302 rr.setBottom( rr.bottom() - 2 ); 303 QPointArray pa; 304 pa.putPoints( 0, 3, 305 rr.left() - 2, rr.top() - 2, 306 rr.right() + 2, rr.top() - 2, 307 rr.left() - 2, rr.bottom() + 2 ); 308 p.setClipRegion( QRegion( pa ) ); 309 p.setPen( QPen( colorGroup().light(), 2 ) ); 310 p.drawEllipse( rr ); 311 pa.resize( 0 ); 312 pa.putPoints( 0, 3, 313 rr.right() + 2, rr.top() - 2, 314 rr.right() + 2, rr.bottom() + 2, 315 rr.left() - 2, rr.bottom() + 2 ); 316 p.setClipRegion( QRegion( pa ) ); 317 p.setPen( QPen( colorGroup().dark(), 2 ) ); 318 p.drawEllipse( rr ); 319 p.setClipping( false ); 320 321 // draw pointer (triangle) 322 double a; 323 calcArrow( a ); 324 double s = sin( a ), 325 c = cos( a ); 326 int r = rr.width() / 2 - 9; 327 double xtr = ((double)rr.left() + rr.right()) * .5 + r * c, 328 ytr = ((double)rr.top() + rr.bottom()) * .5 - r * s; 329 QPointArray ar; 330 ar.putPoints( 0, 3, 331 (int)(xtr + 3.5 * c), (int)(ytr - 3.5 * s), 332 (int)(xtr + 4 * cos(a - 2.0944)), (int)(ytr - 4 * sin(a - 2.0944)), 333 (int)(xtr + 4 * cos(a + 2.0944)), (int)(ytr - 4 * sin(a + 2.0944)) ); 334 p.setBrush( colorGroup().foreground() ); 335 p.setPen( QPen::NoPen ); 336 p.drawPolygon( ar ); 337 338 if( hasFocus() ) 339 style().drawPrimitive( QStyle::PE_FocusRect, &p, rect(), colorGroup() ); 340 } 341 342 // all non-PM styles 343 else 344 { 263 345 bool resetClipping = FALSE; 264 346 … … 385 467 style().drawPrimitive( QStyle::PE_FocusRect, &p, br, colorGroup()); 386 468 } 469 } 470 387 471 p.end(); 388 472 } -
trunk/src/widgets/qlistview.cpp
r2 r174 1574 1574 for ( uint i = 0; i < lv->d->column.size(); ++i ) { 1575 1575 if ( pixmap( i ) ) 1576 { 1577 if ( lv->style().styleHint( QStyle::SH_GUIStyle ) == QStyle::PMStyle ) 1578 ph = QMAX( ph, pixmap( i )->height() + 4 ); 1579 else 1576 1580 ph = QMAX( ph, pixmap( i )->height() ); 1581 } 1577 1582 } 1578 1583 … … 2596 2601 d->vci = 0; 2597 2602 d->timer = new QTimer( this ); 2603 if ( style().styleHint( QStyle::SH_GUIStyle ) == QStyle::PMStyle ) 2604 d->levelWidth = 24; 2605 else 2598 2606 d->levelWidth = 20; 2599 2607 d->r = 0; … … 2613 2621 d->sortcolumn = 0; 2614 2622 d->ascending = TRUE; 2623 if ( style().styleHint( QStyle::SH_GUIStyle ) == QStyle::PMStyle ) 2624 d->allColumnsShowFocus = TRUE; 2625 else 2615 2626 d->allColumnsShowFocus = FALSE; 2616 2627 d->fontMetricsHeight = fontMetrics().height(); … … 8077 8088 if ( d->h->iconSet( col ) ) 8078 8089 w += d->h->iconSet( col )->pixmap().width(); 8090 if ( style().styleHint( QStyle::SH_GUIStyle ) == QStyle::PMStyle ) 8091 w = QMAX( w, 24 ); 8092 else 8079 8093 w = QMAX( w, 20 ); 8080 8094 QFontMetrics fm( fontMetrics() ); -
trunk/src/widgets/qmenubar.cpp
r2 r174 295 295 int h = 2*motifBarVMargin + fm.height() + motifItemVMargin + 2*frameWidth() + 2*motifItemFrame; 296 296 297 if ( style().styleHint( QStyle::SH_GUIStyle ) == QStyle::PMStyle ) 298 h++; 299 297 300 setGeometry( 0, 0, width(), h ); 298 301 … … 483 486 void QMenuBar::languageChange() 484 487 { 485 menuContentsChanged(); 488 menuContentsChanged(); 486 489 } 487 490 … … 729 732 bool reverse = QApplication::reverseLayout(); 730 733 const int yoffset = 1; //(style().styleHint( QStyle::SH_GUIStyle ) == QStyle::WindowsStyle) ? 4 : 1; ### this breaks designer mainwindow editing 731 QPoint pos = r.bottomLeft() + QPoint(0,yoffset); 734 // Warp4style: popup menus are displaced by 4 735 const int xoffset = ( style().styleHint( QStyle::SH_GUIStyle ) == QStyle::PMStyle ) ? -4 : 0; 736 QPoint pos = r.bottomLeft() + QPoint( xoffset, yoffset ); 732 737 if( reverse ) { 733 pos = r.bottomRight() + QPoint( 0,yoffset);738 pos = r.bottomRight() + QPoint( -xoffset, yoffset ); 734 739 pos.rx() -= popup->sizeHint().width(); 735 740 } … … 913 918 x += 2; 914 919 y += 2; 920 } else if ( gs == PMStyle ) { 921 x += 4; 915 922 } 916 923 if ( reverse ) … … 976 983 x += motifBarHMargin; 977 984 y += motifBarVMargin; 985 } else if ( gs == PMStyle ) { 986 x += 5; 978 987 } 979 988 if ( reverse ) -
trunk/src/widgets/qscrollbar.cpp
r2 r174 941 941 flags |= QStyle::Style_Horizontal; 942 942 943 // For the Warp4 style we need to always check also the "add line" and "sub line" 944 // buttons (they could be activated/deactivated!), so we include them here 945 // for every drawing operation 946 if ( style().styleHint( QStyle::SH_GUIStyle ) == QStyle::PMStyle ) 947 controls = controls | 948 QStyle::SC_ScrollBarSubLine | 949 QStyle::SC_ScrollBarAddLine; 950 943 951 style().drawComplexControl(QStyle::CC_ScrollBar, p, this, rect(), colorGroup(), 944 952 flags, (QStyle::SubControl) controls, -
trunk/src/widgets/qslider.cpp
r2 r174 183 183 ticks = NoMarks; 184 184 tickInt = 0; 185 186 if ( style().styleHint( QStyle::SH_GUIStyle ) == QStyle::PMStyle ) 187 setFocusPolicy( StrongFocus ); 188 else 185 189 setFocusPolicy( TabFocus ); 186 190 initTicks(); -
trunk/src/widgets/qspinwidget.cpp
r2 r174 136 136 137 137 uint oldButtonDown = d->buttonDown; 138 138 d->buttonDown = 0; 139 140 // With Warp, the up and down buttons are diagonally separated, 141 // so we are disabling the down button entirely and have to find 142 // out the position of the click within the up button in order 143 // to find out what the user wants! 144 int guiStyle = style().styleHint( QStyle::SH_GUIStyle ); 145 if ( guiStyle == QStyle::PMStyle ) { 146 if ( d->up.contains( e->pos() ) ) { 147 QPoint rp = e->pos() - d->up.topLeft(); 148 if ( d->up.width() > (rp.x() + rp.y()) ) { 149 if ( d->upEnabled ) 150 d->buttonDown = 2; 151 } else { 152 if ( d->downEnabled ) 153 d->buttonDown = 1; 154 } 155 } 156 } else { 139 157 if ( d->down.contains( e->pos() ) && d->downEnabled ) 140 158 d->buttonDown = 1; 141 159 else if ( d->up.contains( e->pos() ) && d->upEnabled ) 142 160 d->buttonDown = 2; 143 else 144 d->buttonDown = 0; 161 } 145 162 146 163 d->theButton = d->buttonDown; … … 149 166 repaint( d->down.unite( d->up ), FALSE ); 150 167 } else if ( d->buttonDown & 1 ) { 168 // do all with the "up" button in PM style - see note above 169 if ( guiStyle == QStyle::PMStyle ) 170 repaint( d->up, FALSE ); 171 else 151 172 repaint( d->down, FALSE ); 152 173 stepDown(); 174 if ( guiStyle == QStyle::PMStyle ) 175 d->startTimer( TRUE, 300 ); 176 else 153 177 d->startTimer( FALSE, 300 ); 154 178 } else if ( d->buttonDown & 2 ) { … … 245 269 d->theButton = 0; 246 270 if ( oldButtonDown != d->theButton ) { 247 if ( oldButtonDown & 1 ) 271 // do all with the "up" button in PM style - 272 // see note in mousePressEvent 273 int guiStyle = style().styleHint( QStyle::SH_GUIStyle ); 274 if ( guiStyle == QStyle::PMStyle ) 275 repaint( d->up, FALSE ); 276 else if ( oldButtonDown & 1 ) 248 277 repaint( d->down, FALSE ); 249 278 else if ( oldButtonDown & 2 ) … … 264 293 return; 265 294 295 // do all with the "up" button in PM style - 296 // see note in mousePressEvent 297 int guiStyle = style().styleHint( QStyle::SH_GUIStyle ); 298 uint clickButton = 0; 299 if ( guiStyle == QStyle::PMStyle ) { 300 if( d->up.contains( e->pos() ) ) { 301 QPoint rp = e->pos() - d->up.topLeft(); 302 if ( d->up.width() > (rp.x() + rp.y()) ) 303 clickButton = 2; 304 else 305 clickButton = 1; 306 } 307 } else { 308 if ( d->down.contains(e->pos()) ) 309 clickButton = 1; 310 else if ( d->up.contains(e->pos()) ) 311 clickButton = 2; 312 } 313 266 314 uint oldButtonDown = d->theButton; 267 if ( oldButtonDown & 1 && !d->down.contains( e->pos() ) ) { 315 if ( (oldButtonDown & 1) && !(clickButton & 1) ) { 316 //if ( oldButtonDown & 1 && !d->down.contains( e->pos() ) ) { 268 317 d->stopTimer(); 269 318 d->theButton = 0; 319 if ( guiStyle == QStyle::PMStyle ) 320 repaint( d->up, FALSE ); 321 else 270 322 repaint( d->down, FALSE ); 271 } else if ( oldButtonDown & 2 && !d->up.contains( e->pos() ) ) { 323 } else if( (oldButtonDown & 2) && !(clickButton & 2) ) { 324 //} else if ( oldButtonDown & 2 && !d->up.contains( e->pos() ) ) { 272 325 d->stopTimer(); 273 326 d->theButton = 0; 274 327 repaint( d->up, FALSE ); 275 } else if ( !oldButtonDown && d->up.contains( e->pos() ) && d->buttonDown & 2 ) { 328 } else if ( !oldButtonDown && (clickButton & 2) && (d->buttonDown & 2) ) { 329 //} else if ( !oldButtonDown && d->up.contains( e->pos() ) && d->buttonDown & 2 ) { 276 330 d->startTimer( 500 ); 277 331 d->theButton = 2; 278 332 repaint( d->up, FALSE ); 279 } else if ( !oldButtonDown && d->down.contains( e->pos() ) && d->buttonDown & 1 ) { 333 } else if(!oldButtonDown && (clickButton & 1) && (d->buttonDown & 1)) { 334 //} else if ( !oldButtonDown && d->down.contains( e->pos() ) && d->buttonDown & 1 ) { 280 335 d->startTimer( 500 ); 281 336 d->theButton = 1; 337 if ( guiStyle == QStyle::PMStyle ) 338 repaint( d->up, FALSE ); 339 else 282 340 repaint( d->down, FALSE ); 283 341 }
Note:
See TracChangeset
for help on using the changeset viewer.