MCPcopy Create free account
hub / github.com/altairwei/WizNotePlus / itemExtraImage

Method itemExtraImage

src/WizAttachmentListWidget.cpp:134–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132}
133
134bool WizAttachmentListView::itemExtraImage(const QModelIndex& index, const QRect& itemBound, QRect& rcImage, QPixmap& extraPix) const
135{
136 if (const WizAttachmentListViewItem* item = attachmentItemFromIndex(index))
137 {
138 QString strIconPath;
139 WizDatabase& db = m_dbMgr.db(item->attachment().strKbGUID);
140 WizMainWindow* mainWindow = WizGlobal::mainWindow();
141 bool isRetina = WizIsHighPixel();
142 strIconPath = ::WizGetSkinResourcePath(mainWindow->userSettings().skin());
143 if (!db.isAttachmentDownloaded(item->attachment().strGUID))
144 {
145 strIconPath += isRetina ? "document_needDownload@2x.png" : "document_needDownload.png";
146 }
147 else if (db.isAttachmentModified(item->attachment().strGUID))
148 {
149 strIconPath += isRetina ? "document_needUpload@2x.png" : "document_needUpload.png";
150 }
151 else
152 return false;
153
154 extraPix = QPixmap(strIconPath);
155 QSize szImage = extraPix.size();
156 WizScaleIconSizeForRetina(szImage);
157 int nMargin = -1;
158 rcImage.setLeft(itemBound.right() - szImage.width() - nMargin);
159 rcImage.setTop(itemBound.bottom() - szImage.height() - nMargin);
160 rcImage.setSize(szImage);
161
162 return true;
163 }
164
165 return false;
166}
167
168void WizAttachmentListView::resetAttachments()
169{

Callers 1

Calls 10

WizIsHighPixelFunction · 0.85
WizGetSkinResourcePathFunction · 0.85
skinMethod · 0.80
sizeMethod · 0.80
widthMethod · 0.80
heightMethod · 0.80
QPixmapClass · 0.50
isAttachmentModifiedMethod · 0.45

Tested by 1