- Wrap FIND_PACKAGE(RTI) in IF(NOT TARGET RTI::nddsc) condition - Prevents placeholder targets from overwriting manually configured RTI:: targets - Manual configuration creates RTI:: targets when BUILD_RTI=ON and RTI found - FIND_PACKAGE only called as fallback when manual config doesn't create targets Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Entire-Checkpoint: 01M1CT3XSQXCX9RQR6WM9DG3GH
128 lines
3.1 KiB
Python
128 lines
3.1 KiB
Python
#!/usr/bin/env python3
|
|
"""Fix QtGui class includes - change QtCore/ClassName to QtGui/ClassName"""
|
|
|
|
import os
|
|
import re
|
|
from pathlib import Path
|
|
|
|
# QtGui classes (not widgets)
|
|
QTGUI_CLASSES = [
|
|
'QPainterPath',
|
|
'QPainter',
|
|
'QPixmap',
|
|
'QImage',
|
|
'QIcon',
|
|
'QCursor',
|
|
'QBrush',
|
|
'QPen',
|
|
'QColor',
|
|
'QFont',
|
|
'QFontMetrics',
|
|
'QFontDatabase',
|
|
'QPalette',
|
|
'QStyle',
|
|
'QStyleOption',
|
|
'QPainterPathStroker',
|
|
'QMatrix',
|
|
'QTransform',
|
|
'QPolygon',
|
|
'QPolygonF',
|
|
'QRegion',
|
|
'QBitmap',
|
|
'QMovie',
|
|
'QPicture',
|
|
'QPictureFormatInterface',
|
|
'QImageReader',
|
|
'QImageWriter',
|
|
'QClipboard',
|
|
'QDrag',
|
|
'QDragEnterEvent',
|
|
'QDragMoveEvent',
|
|
'QDragLeaveEvent',
|
|
'QDropEvent',
|
|
'QPaintEvent',
|
|
'QResizeEvent',
|
|
'QMoveEvent',
|
|
'QMouseEvent',
|
|
'QHoverEvent',
|
|
'QWheelEvent',
|
|
'QFocusEvent',
|
|
'QHideEvent',
|
|
'QShowEvent',
|
|
'QCloseEvent',
|
|
'QContextMenuEvent',
|
|
'QKeyEvent',
|
|
'QInputEvent',
|
|
'QTabletEvent',
|
|
'QGestureEvent',
|
|
'QShortcutEvent',
|
|
'QGraphicsSceneEvent',
|
|
'QGraphicsSceneMouseEvent',
|
|
'QGraphicsSceneWheelEvent',
|
|
'QGraphicsSceneContextMenuEvent',
|
|
'QGraphicsSceneHoverEvent',
|
|
'QGraphicsSceneDragDropEvent',
|
|
'QGraphicsSceneResizeEvent',
|
|
'QGraphicsSceneMoveEvent',
|
|
'QStandardItemModel',
|
|
'QStandardItem',
|
|
'QFileSystemModel',
|
|
'QSortFilterProxyModel',
|
|
'QAbstractItemModel',
|
|
'QAbstractListModel',
|
|
'QAbstractTableModel',
|
|
'QItemSelectionModel',
|
|
'QModelIndex',
|
|
'QItemSelection',
|
|
'QIdentityProxyModel',
|
|
]
|
|
|
|
def fix_file(filepath):
|
|
"""Fix QtGui includes in a file"""
|
|
with open(filepath, 'r', encoding='utf-8', errors='ignore') as f:
|
|
content = f.read()
|
|
|
|
original = content
|
|
fixes = 0
|
|
|
|
for class_name in QTGUI_CLASSES:
|
|
# Match #include <QtCore/ClassName>
|
|
pattern = f'#include\\s*<QtCore/{class_name}>'
|
|
replacement = f'#include <QtGui/{class_name}>'
|
|
|
|
matches = re.findall(pattern, content)
|
|
if matches:
|
|
content = re.sub(pattern, replacement, content)
|
|
fixes += len(matches)
|
|
print(f" Fixed: {class_name} ({len(matches)}x)")
|
|
|
|
if fixes > 0:
|
|
with open(filepath, 'w', encoding='utf-8') as f:
|
|
f.write(content)
|
|
|
|
return fixes
|
|
|
|
def main():
|
|
repo_dir = Path('/home/torsten/swy/sandbox/qt-migration-legatus/qt6-after/qt6-migrated-legatus')
|
|
|
|
total_files = 0
|
|
total_fixes = 0
|
|
|
|
for ext in ['*.h', '*.cpp', '*.hpp', '*.cc', '*.cxx']:
|
|
for filepath in repo_dir.rglob(ext):
|
|
# Skip build directories
|
|
if 'build' in str(filepath) or 'CMakeFiles' in str(filepath):
|
|
continue
|
|
|
|
fixes = fix_file(filepath)
|
|
if fixes > 0:
|
|
total_files += 1
|
|
total_fixes += fixes
|
|
print(f"{filepath.relative_to(repo_dir)}")
|
|
|
|
print(f"\n✅ QtGui Include Fix Complete:")
|
|
print(f" Files updated: {total_files}")
|
|
print(f" Total fixes: {total_fixes}")
|
|
|
|
if __name__ == '__main__':
|
|
main() |