//could use Window as well...
//FilePickerWindow::FilePickerWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog)
//could use Window as well...
//FilePickerWindow::FilePickerWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog)
)));
data->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
dataLayout->addWidget(data);
)));
data->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
dataLayout->addWidget(data);
+
+ insertCart = new QPushButton(QIcon(":/res/generic.png"), "", this);
+ insertCart->setDefault(true); // We want this button to be the default
+ insertCart->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
+ dataLayout->addWidget(insertCart);
// QItemSelectionModel * ism = fileList->selectionModel();
// connect(ism, SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(UpdateSelection(const QModelIndex &, const QModelIndex &)));
connect(fileList->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(UpdateSelection(const QModelIndex &, const QModelIndex &)));
// QItemSelectionModel * ism = fileList->selectionModel();
// connect(ism, SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(UpdateSelection(const QModelIndex &, const QModelIndex &)));
connect(fileList->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(UpdateSelection(const QModelIndex &, const QModelIndex &)));
model->AddData(index, str, QImage(), size);
}
model->AddData(index, str, QImage(), size);
}
//
// This slot gets called when the QListView gets clicked on. Updates
// the cart graphic and accompanying text.
//
// This slot gets called when the QListView gets clicked on. Updates
// the cart graphic and accompanying text.
// printf("FPW: %s\n", s.toAscii().data());
unsigned long fileSize = current.model()->data(current, Qt::WhatsThisRole).toUInt();
#else
// printf("FPW: %s\n", s.toAscii().data());
unsigned long fileSize = current.model()->data(current, Qt::WhatsThisRole).toUInt();
#else
- QString s = current.model()->data(current, FLM_FILENAME).toString();
+// QString s = current.model()->data(current, FLM_FILENAME).toString();
+ currentFile = current.model()->data(current, FLM_FILENAME).toString();
unsigned long i = current.model()->data(current, FLM_INDEX).toUInt();
QImage label = current.model()->data(current, FLM_LABEL).value<QImage>();
unsigned long fileSize = current.model()->data(current, FLM_FILESIZE).toUInt();
// printf("FPW: %s\n", s.toAscii().data());
#endif
unsigned long i = current.model()->data(current, FLM_INDEX).toUInt();
QImage label = current.model()->data(current, FLM_LABEL).value<QImage>();
unsigned long fileSize = current.model()->data(current, FLM_FILESIZE).toUInt();
// printf("FPW: %s\n", s.toAscii().data());
#endif
//Though this should probably be done when this is loaded, instead of every time here...
//QImage scaledImg = label.scaled(373, 172, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
//painter.drawPixmap(23, 87, QPixmap::fromImage(scaledImg));
//Though this should probably be done when this is loaded, instead of every time here...
//QImage scaledImg = label.scaled(373, 172, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
//painter.drawPixmap(23, 87, QPixmap::fromImage(scaledImg));
painter.drawPixmap(23, 87, QPixmap::fromImage(label));
// painter.drawPixmap(23, 87, 373, 172, QPixmap::fromImage(label));
painter.end();
cartImage->setPixmap(QPixmap::fromImage(cart));
}
painter.drawPixmap(23, 87, QPixmap::fromImage(label));
// painter.drawPixmap(23, 87, 373, 172, QPixmap::fromImage(label));
painter.end();
cartImage->setPixmap(QPixmap::fromImage(cart));
}
+ else
+ {
+ // We should try to be intelligent with our updates here, and only redraw when
+ // we're going from a selection with a label to a selection without. Now, we
+ // redraw regardless.
+ QImage cart(":/res/cart-blank.png");
+ QPainter painter(&cart);
+ painter.drawPixmap(23, 87, QPixmap::fromImage(QImage(":/res/label-blank.png")));
+ painter.end();
+ cartImage->setPixmap(QPixmap::fromImage(cart));
+ }