1 diff --git a/README.kde-qt b/README.kde-qt
7 +This is a patched version of Qt. It may include changes made by KDE
8 +and Qt developers that have either not been accepted for inclusion
9 +into Qt, or have been accepted for a later version of Qt than this
15 +The recommended compile line is:
17 +--default-config-begin--
19 + ./configure -qt-gif -debug -fast -no-separate-debug-info \
20 + -system-libpng -system-libjpeg -system-zlib \
21 + -dbus -webkit -plugin-sql-mysql \
22 + -nomake examples -nomake demos -prefix <installdir>
24 +--default-config-end--
26 +It contains "-debug", which greatly improves the use for backtraces (but
27 +also needs a lot more disk space and makes things slower). To build in
28 +release mode, replace it with "-release".
30 +It also contains "-no-separate-debug-info", which disables separate .debug
31 +files. Instead, the debug information will be built into the libraries.
32 +This option is needed when you install Qt.
34 +If you don't install Qt, it can be useful to disable this option,
35 +thus having separate debug symbol files. With separate debug files, you can
36 +just move those debug files to another directory to remove Qt debug symbols.
37 +Moving the files back will enable Qt debug symbols again.
38 +This is useful if you rarely need to step into Qt functions during debugging,
39 +because GDB loads much faster and uses less memory without Qt debug symbols.
40 +In the rare case you need to step into Qt code, you can temporarily enable
41 +debug symbols again by moving the debug files back. You can even load the Qt
42 +debug symbols from within GDB on demand, using the "symbol-file" command.
44 +If you are planning to compile Qt using an Icecream cluster you have to
45 +pass the option -no-pch (no precompiled headers) to configure to make
46 +distributed compilation work.
51 +To compile Qt on a Unix platform, run:
53 + export MAKEFLAGS=-j2
57 +If your computer has more than one core or processor, you may consider
58 +increasing the "2" above. If you've got a compile farm available, you
59 +should adjust the -j argument to match the number of slots in that
62 +3. Modifying & rebuilding Qt
63 +============================
65 +If you make modifications to the Qt source code, you don't need to
66 +build everything again. Simply go to the directory containing the
67 +Makefile closest to the files you changed and run "make" again.
69 +For example, if you've modified src/corelib/io/qiodevice.cpp, do:
74 +If you make a change that is not temporary, you should create a Git
75 +commit out of it. However, you shouldn't push those changes to
76 +kde-qt.git. If you have a fix that benefit others, see the "Creating
77 +kde-qt.git modifications" section below.
79 +4. Building Qt examples and demos
80 +=================================
82 +The "-nomake examples -nomake demos" arguments to the configure script
83 +mean that those two sections will not be configured for building,
84 +which is unneeded for usage of the library. If you want to compile
85 +the examples or demos later, just enter either directory and type:
93 +(Official information: http://qt.gitorious.org/qt/pages/QtAutotestsEnvironment)
95 +In order to run Qt tests, you must have a "developer build" of Qt. For
96 +that, you need to reconfigure Qt and add the "-developer-build"
97 +option. That option is technically equivalent to the options:
99 + -debug -prefix $PWD -DQT_BUILD_INTERNAL
101 +To run a test, go to its source dir in tests/auto/testname. Type
102 +"make" to build it, then run it (either ./tst_testname, or "make install").
104 +6. Building Qt documentation
105 +============================
107 +To build and install the documentation, run:
113 +It is necessary to do this once only, even if you rebuild Qt later.
115 +7. Using Qt uninstalled
116 +=======================
118 +To use without having to install it, configure it as follows:
120 + ./configure <other configure options> -prefix $PWD
124 +Attention: DO NOT run
128 +If you do, Qt will overwrite your include/ directory with its
131 +8. Creating kde-qt.git modifications
132 +====================================
134 +If you have fixed a bug in Qt or modified it in any way that may
135 +benefit others, please share your change in the form of a patch. Do
136 +not commit your changes directly to the main branch because they
137 +may be lost in a future update if they have not been added to the
138 +official Qt release.
140 +The exception to the above rule is that if the fix has been accepted
141 +by Qt Software (and so will appear in the very next release of Qt),
142 +then it should be simply cherry-picked from the Qt development
143 +branch. Note that you shouldn't do this for changes that have been
144 +accepted into a release which is not the very next.
145 +In this case, you should use the following command:
147 + git cherry-pick -x SHA1_OF_THE_FIX
148 +where SHA1_OF_THE_FIX is the SHA-1 of the commit that you want to
149 +introduce. Then push the change to the server.
151 +Before creating a patch, it is recommended to contact Qt Software
152 +support via qt-bugs@trolltech.com and explain the situation. There may
153 +be a solution for the problem already or a new direction that should
156 +To create a patch, do the following:
157 + a) look at the listing of branches in
158 + http://qt.gitorious.org/+kde-developers/qt/kde-qt/commits/HEAD and
159 + select the next number.
161 + b) create a new branch out of a clean, released version of Qt, (for
162 + example, 4.5.1), using the number above and a brief description of
163 + your fix. For example:
164 + git checkout -b patches/0180-window-role v4.5.1
165 + You can see the available released versions of Qt with:
168 + c) make your changes to the Qt source code and verify that it
169 + compiles, links and works (please run the respective unit tests).
171 + c) commit your changes to Git, using the "git commit" command. Please
172 + see http://qt.gitorious.org/qt/pages/GitIntroductionWithQt and
173 + http://qt.gitorious.org/qt/pages/QtCodingStyle for information on
174 + how to create commits
175 + Note that you can create multiple commits.
177 + e) merge the change to the main branch, for example, 4.5.1-patched:
178 + git checkout 4.5.1-patched
179 + git merge patches/0180-window-role
181 + f) push the changes you made to your branch and to the main server:
182 + git push git@gitorious.org:qt/kde-qt.git 4.5.1-patched patches/0180-window-role
183 + (Don't forget to list both branch names)
185 +Don't forget to submit your patch to using the Qt Contribution Model,
186 +along with the long description of the issue found. See
187 +http://qt.gitorious.org/qt/pages/QtContributionGuidelines for
188 +information how. You can submit the branch you've just sent to the
191 +9. Troubleshooting: Re-configuring and re-compiling
192 +==================================================
194 +For those updating the source in a directory where Qt has already
195 +been compiled, you may need to run the following commands from the
196 +top directory of your Qt sources:
198 + find . -name '*.moc' | xargs rm
200 +Sometimes ./configure will refuse to run. You may need to:
203 +If you think you may have run "make install" on an install-less Qt
204 +(srcdir == $QTDIR), run:
208 diff --git a/bin/syncqt b/bin/syncqt
209 index a14a82d..ac140eb 100755
212 @@ -366,9 +366,13 @@ sub fixPaths {
217 + if($match_dir =~ /^[a-zA-Z]:$/) {
221 my $after = substr($dir, length($match_dir));
222 - my $count = ($after =~ tr,/,,);
223 + my $count = ($after =~ tr,/,,) - $cnt_ofs;
225 for(my $i = 0; $i < $count; $i++) {
227 diff --git a/configure b/configure
228 index 146ba82..7be8f7c 100755
231 @@ -1012,6 +1012,11 @@ while [ "$#" -gt 0 ]; do
232 VAL=`echo $1 | sed 's,-D,,'`
236 + VAR="add_isystempath"
242 if [ "$1" = "-I" ]; then
243 @@ -2020,6 +2025,9 @@ while [ "$#" -gt 0 ]; do
245 I_FLAGS="$I_FLAGS -I\"${VAL}\""
248 + I_FLAGS="$I_FLAGS -isystem \"${VAL}\""
251 L_FLAGS="$L_FLAGS -L\"${VAL}\""
253 diff --git a/projects.pro b/projects.pro
254 index aa1eb71..8ae64c2 100644
257 @@ -149,6 +149,9 @@ unix {
258 DEFAULT_QMAKESPEC ~= s,^.*mkspecs/,,g
259 mkspecs.commands += $(DEL_FILE) $(INSTALL_ROOT)$$mkspecs.path/default; $(SYMLINK) $$DEFAULT_QMAKESPEC $(INSTALL_ROOT)$$mkspecs.path/default
262 + mkspecs.files += $$QT_BUILD_TREE/mkspecs/default
266 false:macx { #mac install location
267 diff --git a/qmake/property.cpp b/qmake/property.cpp
268 index ea4842a..ac54854 100644
269 --- a/qmake/property.cpp
270 +++ b/qmake/property.cpp
271 @@ -81,29 +81,32 @@ QMakeProperty::keyBase(bool version) const
273 QMakeProperty::value(QString v, bool just_check)
276 if(v == "QT_INSTALL_PREFIX")
277 - return QLibraryInfo::location(QLibraryInfo::PrefixPath);
278 + ret = QLibraryInfo::location(QLibraryInfo::PrefixPath);
279 else if(v == "QT_INSTALL_DATA")
280 - return QLibraryInfo::location(QLibraryInfo::DataPath);
281 + ret = QLibraryInfo::location(QLibraryInfo::DataPath);
282 else if(v == "QT_INSTALL_DOCS")
283 - return QLibraryInfo::location(QLibraryInfo::DocumentationPath);
284 + ret = QLibraryInfo::location(QLibraryInfo::DocumentationPath);
285 else if(v == "QT_INSTALL_HEADERS")
286 - return QLibraryInfo::location(QLibraryInfo::HeadersPath);
287 + ret = QLibraryInfo::location(QLibraryInfo::HeadersPath);
288 else if(v == "QT_INSTALL_LIBS")
289 - return QLibraryInfo::location(QLibraryInfo::LibrariesPath);
290 + ret = QLibraryInfo::location(QLibraryInfo::LibrariesPath);
291 else if(v == "QT_INSTALL_BINS")
292 - return QLibraryInfo::location(QLibraryInfo::BinariesPath);
293 + ret = QLibraryInfo::location(QLibraryInfo::BinariesPath);
294 else if(v == "QT_INSTALL_PLUGINS")
295 - return QLibraryInfo::location(QLibraryInfo::PluginsPath);
296 + ret = QLibraryInfo::location(QLibraryInfo::PluginsPath);
297 else if(v == "QT_INSTALL_TRANSLATIONS")
298 - return QLibraryInfo::location(QLibraryInfo::TranslationsPath);
299 + ret = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
300 else if(v == "QT_INSTALL_CONFIGURATION")
301 - return QLibraryInfo::location(QLibraryInfo::SettingsPath);
302 + ret = QLibraryInfo::location(QLibraryInfo::SettingsPath);
303 else if(v == "QT_INSTALL_EXAMPLES")
304 - return QLibraryInfo::location(QLibraryInfo::ExamplesPath);
305 + ret = QLibraryInfo::location(QLibraryInfo::ExamplesPath);
306 else if(v == "QT_INSTALL_DEMOS")
307 - return QLibraryInfo::location(QLibraryInfo::DemosPath);
308 - else if(v == "QMAKE_MKSPECS")
309 + ret = QLibraryInfo::location(QLibraryInfo::DemosPath);
311 + return QDir::toNativeSeparators(ret);
312 + if(v == "QMAKE_MKSPECS")
313 return qmake_mkspec_paths().join(Option::target_mode == Option::TARG_WIN_MODE ? ";" : ":");
314 else if(v == "QMAKE_VERSION")
315 return qmake_version();
316 @@ -116,7 +119,7 @@ QMakeProperty::value(QString v, bool just_check)
317 int slash = v.lastIndexOf('/');
318 QVariant var = settings->value(keyBase(slash == -1) + v);
319 bool ok = var.isValid();
320 - QString ret = var.toString();
321 + ret = var.toString();
323 QString version = qmake_version();
325 diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
326 index 9614e7a..58493a5 100644
327 --- a/src/corelib/kernel/qobject.cpp
328 +++ b/src/corelib/kernel/qobject.cpp
329 @@ -1136,8 +1136,16 @@ void QObject::setObjectName(const QString &name)
332 d->objectName = name;
333 +#if defined(Q_WS_X11)
334 + d->checkWindowRole();
338 +#if defined(Q_WS_X11)
339 +void QObjectPrivate::checkWindowRole()
346 diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h
347 index e75f24e..1294fa4 100644
348 --- a/src/corelib/kernel/qobject_p.h
349 +++ b/src/corelib/kernel/qobject_p.h
350 @@ -83,7 +83,9 @@ void Q_CORE_EXPORT qt_register_signal_spy_callbacks(const QSignalSpyCallbackSet
352 extern QSignalSpyCallbackSet Q_CORE_EXPORT qt_signal_spy_callback_set;
354 -enum { QObjectPrivateVersion = QT_VERSION };
355 +// add 0x1000000 to mark it as qt-copy version, with possible modifications
356 +// in some Q*Private class
357 +enum { QObjectPrivateVersion = QT_VERSION + 0x1000000 };
359 class Q_CORE_EXPORT QDeclarativeData
361 @@ -157,6 +159,9 @@ public:
362 void sendPendingChildInsertedEvents();
363 void removePendingChildInsertedEvents(QObject *child);
365 +#if defined(Q_WS_X11)
366 + virtual void checkWindowRole();
369 static Sender *setCurrentSender(QObject *receiver,
371 diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
372 index 528d512..edbe75b 100644
373 --- a/src/gui/kernel/qkeysequence.cpp
374 +++ b/src/gui/kernel/qkeysequence.cpp
375 @@ -1139,10 +1139,10 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
377 QList<QModifKeyName> modifs;
379 - modifs << QModifKeyName(Qt::CTRL, QShortcut::tr("Ctrl").toLower().append(QLatin1Char('+')))
380 - << QModifKeyName(Qt::SHIFT, QShortcut::tr("Shift").toLower().append(QLatin1Char('+')))
381 - << QModifKeyName(Qt::ALT, QShortcut::tr("Alt").toLower().append(QLatin1Char('+')))
382 - << QModifKeyName(Qt::META, QShortcut::tr("Meta").toLower().append(QLatin1Char('+')));
383 + modifs << QModifKeyName(Qt::CTRL, QShortcut::tr("Ctrl", "Ctrl key, used for shortcuts").toLower().append(QLatin1Char('+')))
384 + << QModifKeyName(Qt::SHIFT, QShortcut::tr("Shift", "Shift key, used for shortcuts").toLower().append(QLatin1Char('+')))
385 + << QModifKeyName(Qt::ALT, QShortcut::tr("Alt", "Alt key, used for shortcuts").toLower().append(QLatin1Char('+')))
386 + << QModifKeyName(Qt::META, QShortcut::tr("Meta", "Meta key, used for shortcuts").toLower().append(QLatin1Char('+')));
388 modifs += *gmodifs; // Test non-translated ones last
390 @@ -1232,7 +1232,7 @@ QString QKeySequence::encodeString(int key)
391 static inline void addKey(QString &str, const QString &theKey, QKeySequence::SequenceFormat format)
394 - str += (format == QKeySequence::NativeText) ? QShortcut::tr("+")
395 + str += (format == QKeySequence::NativeText) ? QShortcut::tr("+", "Symbol used to concatenate keys in shortcuts")
396 : QString::fromLatin1("+");
399 @@ -1272,13 +1272,13 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat
401 // On other systems the order is Meta, Control, Alt, Shift
402 if ((key & Qt::META) == Qt::META)
403 - s = nativeText ? QShortcut::tr("Meta") : QString::fromLatin1("Meta");
404 + s = nativeText ? QShortcut::tr("Meta", "Meta key, used for shortcuts") : QString::fromLatin1("Meta");
405 if ((key & Qt::CTRL) == Qt::CTRL)
406 - addKey(s, nativeText ? QShortcut::tr("Ctrl") : QString::fromLatin1("Ctrl"), format);
407 + addKey(s, nativeText ? QShortcut::tr("Ctrl", "Ctrl key, used for shortcuts") : QString::fromLatin1("Ctrl"), format);
408 if ((key & Qt::ALT) == Qt::ALT)
409 - addKey(s, nativeText ? QShortcut::tr("Alt") : QString::fromLatin1("Alt"), format);
410 + addKey(s, nativeText ? QShortcut::tr("Alt", "Alt key, used for shortcuts") : QString::fromLatin1("Alt"), format);
411 if ((key & Qt::SHIFT) == Qt::SHIFT)
412 - addKey(s, nativeText ? QShortcut::tr("Shift") : QString::fromLatin1("Shift"), format);
413 + addKey(s, nativeText ? QShortcut::tr("Shift", "Shift key, used for shortcuts") : QString::fromLatin1("Shift"), format);
417 @@ -1293,7 +1293,7 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat
418 p += QChar((key-0x10000)%400+0xdc00);
420 } else if (key >= Qt::Key_F1 && key <= Qt::Key_F35) {
421 - p = nativeText ? QShortcut::tr("F%1").arg(key - Qt::Key_F1 + 1)
422 + p = nativeText ? QShortcut::tr("F%1", "Fx key, used for shortcuts").arg(key - Qt::Key_F1 + 1)
423 : QString::fromLatin1("F%1").arg(key - Qt::Key_F1 + 1);
426 diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
427 index 7832393..18c331a 100644
428 --- a/src/gui/kernel/qwidget_p.h
429 +++ b/src/gui/kernel/qwidget_p.h
430 @@ -661,6 +661,7 @@ public:
431 static QWidget *keyboardGrabber;
433 void setWindowRole();
434 + virtual void checkWindowRole();
435 void sendStartupMessage(const char *message) const;
436 void setNetWmWindowTypes();
437 void x11UpdateIsOpaque();
438 diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp
439 index 3135ece..5c997a4 100644
440 --- a/src/gui/kernel/qwidget_x11.cpp
441 +++ b/src/gui/kernel/qwidget_x11.cpp
442 @@ -763,6 +763,11 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
444 XChangeWindowAttributes(dpy, id, CWOverrideRedirect | CWSaveUnder,
446 + XClassHint class_hint;
447 + QByteArray appName = qAppName().toLatin1();
448 + class_hint.res_name = appName.data(); // application name
449 + class_hint.res_class = const_cast<char *>(QX11Info::appClass()); // application class
450 + XSetWMProperties(dpy, id, 0, 0, 0, 0, 0, 0, &class_hint);
451 } else if (topLevel && !desktop) { // top-level widget
452 if (!X11->wm_client_leader)
453 create_wm_client_leader();
454 @@ -816,32 +821,40 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
455 // set EWMH window types
456 setNetWmWindowTypes();
458 + // when we create a toplevel widget, the frame strut should be dirty
459 + data.fstrut_dirty = 1;
462 + // non-toplevel widgets don't have a frame, so no need to
463 + // update the strut
464 + data.fstrut_dirty = 0;
467 + if (initializeWindow && (popup || (topLevel && !desktop))) { // properties set on all toplevel windows
469 long curr_pid = getpid();
470 XChangeProperty(dpy, id, ATOM(_NET_WM_PID), XA_CARDINAL, 32, PropModeReplace,
471 (unsigned char *) &curr_pid, 1);
473 - // when we create a toplevel widget, the frame strut should be dirty
474 - data.fstrut_dirty = 1;
476 // declare the widget's window role
477 + QByteArray windowRole;
478 if (QTLWExtra *topData = maybeTopData()) {
479 - if (!topData->role.isEmpty()) {
480 - QByteArray windowRole = topData->role.toUtf8();
481 - XChangeProperty(dpy, id,
482 - ATOM(WM_WINDOW_ROLE), XA_STRING, 8, PropModeReplace,
483 - (unsigned char *)windowRole.constData(), windowRole.length());
485 + if (!topData->role.isEmpty())
486 + windowRole = topData->role.toUtf8();
488 + if (windowRole.isEmpty()) // use object name as a fallback
489 + windowRole = objectName.toUtf8();
490 + if (!windowRole.isEmpty()) {
491 + XChangeProperty(dpy, id,
492 + ATOM(WM_WINDOW_ROLE), XA_STRING, 8, PropModeReplace,
493 + (unsigned char *)windowRole.constData(), windowRole.length());
496 // set client leader property
497 XChangeProperty(dpy, id, ATOM(WM_CLIENT_LEADER),
498 XA_WINDOW, 32, PropModeReplace,
499 (unsigned char *)&X11->wm_client_leader, 1);
501 - // non-toplevel widgets don't have a frame, so no need to
502 - // update the strut
503 - data.fstrut_dirty = 0;
506 if (initializeWindow && q->internalWinId()) {
507 @@ -2919,6 +2932,17 @@ void QWidgetPrivate::setWindowRole()
508 (unsigned char *)windowRole.constData(), windowRole.length());
511 +void QWidgetPrivate::checkWindowRole()
514 + if( !q->windowRole().isEmpty() || !q->internalWinId())
516 + QByteArray windowRole = objectName.toUtf8(); // use as a fallback
517 + XChangeProperty(X11->display, q->internalWinId(),
518 + ATOM(WM_WINDOW_ROLE), XA_STRING, 8, PropModeReplace,
519 + (unsigned char *)windowRole.constData(), windowRole.length());
522 Q_GLOBAL_STATIC(QX11PaintEngine, qt_widget_paintengine)
523 QPaintEngine *QWidget::paintEngine() const
525 diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp
526 index 30f6144..36dfe6d 100644
527 --- a/src/gui/widgets/qtabbar.cpp
528 +++ b/src/gui/widgets/qtabbar.cpp
529 @@ -678,8 +678,8 @@ void QTabBarPrivate::refresh()
531 makeVisible(currentIndex);
533 - q->updateGeometry();
535 + q->updateGeometry();
539 diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp
540 index 8e033b7..b5b2edd 100644
541 --- a/src/tools/moc/main.cpp
542 +++ b/src/tools/moc/main.cpp
543 @@ -94,7 +94,13 @@ static QByteArray combinePath(const char *infile, const char *outfile)
544 inSplitted.prepend(QLatin1String(".."));
546 inSplitted.append(inFileInfo.fileName());
548 + const QString rel = inSplitted.join(QLatin1String("/"));
549 + const QString abs = inFileInfo.absoluteFilePath();
550 + return QFile::encodeName(rel.length() < abs.length() ? rel : abs);
552 return QFile::encodeName(inSplitted.join(QLatin1String("/")));