mirror of
https://github.com/leozide/leocad
synced 2025-01-30 20:34:56 +01:00
Fixed Qt4 errors.
This commit is contained in:
parent
31cf6456b3
commit
e84fef5c73
2 changed files with 9 additions and 6 deletions
|
@ -67,6 +67,7 @@ QSize lcPartSelectionItemDelegate::sizeHint(const QStyleOptionViewItem& Option,
|
|||
lcPartSelectionListModel::lcPartSelectionListModel(QObject* Parent)
|
||||
: QAbstractListModel(Parent)
|
||||
{
|
||||
mListView = (lcPartSelectionListView*)Parent;
|
||||
mIconSize = 0;
|
||||
mLastDrawTime = QDateTime::currentDateTime();
|
||||
}
|
||||
|
@ -203,12 +204,11 @@ void lcPartSelectionListModel::DrawPreview()
|
|||
|
||||
if (Elapsed < 100)
|
||||
{
|
||||
QTimer::singleShot(100 - Elapsed, this, &lcPartSelectionListModel::DrawPreview);
|
||||
QTimer::singleShot(100 - Elapsed, this, SLOT(DrawPreview()));
|
||||
return;
|
||||
}
|
||||
|
||||
lcPartSelectionListView* ListView = (lcPartSelectionListView*)parent();
|
||||
QRegion VisibleRegion = ListView->viewport()->visibleRegion();
|
||||
QRegion VisibleRegion = mListView->viewport()->visibleRegion();
|
||||
int InfoIndex;
|
||||
|
||||
for (;;)
|
||||
|
@ -217,7 +217,7 @@ void lcPartSelectionListModel::DrawPreview()
|
|||
return;
|
||||
|
||||
InfoIndex = mRequestedPreviews.takeLast();
|
||||
QRect ItemRect = ListView->visualRect(ListView->GetFilterModel()->mapFromSource(index(InfoIndex, 0)));
|
||||
QRect ItemRect = mListView->visualRect(mListView->GetFilterModel()->mapFromSource(index(InfoIndex, 0)));
|
||||
|
||||
if (VisibleRegion.contains(ItemRect) || VisibleRegion.intersects(ItemRect))
|
||||
break;
|
||||
|
@ -271,7 +271,7 @@ void lcPartSelectionListModel::DrawPreview()
|
|||
Context->EndRenderToTexture();
|
||||
|
||||
mLastDrawTime = QDateTime::currentDateTime();
|
||||
QTimer::singleShot(100, this, &lcPartSelectionListModel::DrawPreview);
|
||||
QTimer::singleShot(100, this, SLOT(DrawPreview()));
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 2, 0))
|
||||
emit dataChanged(index(InfoIndex, 0), index(InfoIndex, 0), QVector<int>() << Qt::DecorationRole);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define _LC_PARTSELECTIONWIDGET_H_
|
||||
|
||||
class lcPartSelectionListModel;
|
||||
class lcPartSelectionListView;
|
||||
|
||||
class lcPartSelectionFilterModel : public QSortFilterProxyModel
|
||||
{
|
||||
|
@ -64,9 +65,11 @@ public:
|
|||
void RequestPreview(int InfoIndex);
|
||||
void SetIconSize(int Size);
|
||||
|
||||
protected:
|
||||
protected slots:
|
||||
void DrawPreview();
|
||||
|
||||
protected:
|
||||
lcPartSelectionListView* mListView;
|
||||
QVector<QPair<PieceInfo*, QPixmap>> mParts;
|
||||
QList<int> mRequestedPreviews;
|
||||
QDateTime mLastDrawTime;
|
||||
|
|
Loading…
Add table
Reference in a new issue