本文整理汇总了C++中ImageWidget类的典型用法代码示例。如果您正苦于以下问题:C++ ImageWidget类的具体用法?C++ ImageWidget怎么用?C++ ImageWidget使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ImageWidget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setWindowTitle
ImageFilterExampleWidget::ImageFilterExampleWidget(QWidget* parent) {
setWindowTitle(tr("OpenCL Image Filter Examples"));
setFixedSize(820,500);
ImageWidget *before = new ImageWidget(this);
ImageWidget *oclFiltered = new ImageWidget(this);
beforeW=before;
afterW=oclFiltered;
QLabel *beforeLabel = new QLabel(tr("Before"));
beforeLabel->setAlignment(Qt::AlignHCenter);
QLabel *afterLabel = new QLabel(tr("Ocl"));
afterLabel->setAlignment(Qt::AlignHCenter);
createMenu();
before->setFixedSize(400,400);
oclFiltered->setFixedSize(400,400);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
mainLayout->addWidget(this->menuBar);
mainLayout->setMenuBar(this->menuBar);
QGridLayout *layout = new QGridLayout;
// layout->addWidget(menubar,0,0);
layout->addWidget(before, 0, 0);
layout->addWidget(oclFiltered, 0, 1);
layout->addWidget(beforeLabel, 1, 0);
layout->addWidget(afterLabel, 1, 1);
mainLayout->addLayout(layout);
}
示例2: QScrollArea
void MainWindow::OpenImage(const QString &fileName)
{
QScrollArea* area = new QScrollArea();
ImageWidget* img = new ImageWidget();
// Nur les- und schreibbare Bildformate werden unterstützt
if (img->OpenImage(fileName)) {
QString shortFileName = ParseFileName(fileName);
shortFileName = shortFileName.mid(0, shortFileName.lastIndexOf('.'));
// Bild in die ScrollArea laden
area->setWidget(img);
area->setStyleSheet("background: qlineargradient(x1: 0, y0: 1, x2:1, y2: 0, stop: 0.96 #383838, stop: 0.99 #2e2e2e);");
// neuen Tab hinzufügen
int index = ui->imagetab->addTab(area, shortFileName);
ui->imagetab->setTabToolTip(index, shortFileName);
ui->imagetab->setCurrentIndex(index);
// schließlich Signalhandler setzen
connect(this, SIGNAL(Arguments(QHash<QString,QString>)), img, SLOT(Arguments(QHash<QString,QString>)));
connect(this, SIGNAL(Operation(IOperation*,QHash<QString,QString>)), img, SLOT(Operation(IOperation*,QHash<QString,QString>)));
connect(this, SIGNAL(Operation(IOperation*,QHash<QString,QString>,OperationType)), img, SLOT(Operation(IOperation*,QHash<QString,QString>,OperationType)));
emit Operation(mOperation, GetArgs());
}
示例3: DataRenderer
OpenCVImageListRenderer::OpenCVImageListRenderer(QWidget* parent) :
DataRenderer(parent),
m_busy(false)
{
m_layout = new QHBoxLayout(this);
ImageWidget* imageWidget = new ImageWidget;
m_imageWidgets.append(imageWidget);
m_layout->addWidget( imageWidget );
QImage image = QImage(320,240,QImage::Format_RGB32);
image.fill( qRgb(0,0,0) );
// TODO make minimum configurable somewhere
imageWidget->setMinimumSize( 160, 120 );
imageWidget->setImage( image );
this->setLayout( m_layout );
m_converter = new ImageConverter(this);
qRegisterMetaType< QList<QImage> >("QList<QImage>");
connect( m_converter, SIGNAL( convertedList( QList<QImage>, int ) ),
this, SLOT( updateImages( QList<QImage>, int ) ),
Qt::UniqueConnection);
}
示例4: main
int main(int argc, char *argv[])
{
installLogcatMessageHandler("qimageviewer");
QApplication a(argc, argv);
QFont f = a.font();
f.setPixelSize(20);
a.setFont(f);
ImageWidget w;
w.show();
return a.exec();
}
示例5: QPen
void ImageWidget::restore(Graph *g, const QStringList& lst)
{
int frameStyle = 0;
QPen pen = QPen(Qt::black, 1, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin);
double x = 0.0, y = 0.0, right = 0.0, bottom = 0.0;
QStringList::const_iterator line;
QString fn;
bool save_xpm = false;
ImageWidget *i = NULL;
for (line = lst.begin(); line != lst.end(); line++){
QString s = *line;
if (s.contains("<Frame>"))
frameStyle = s.remove("<Frame>").remove("</Frame>").toInt();
else if (s.contains("<Color>"))
pen.setColor(QColor(s.remove("<Color>").remove("</Color>")));
else if (s.contains("<FrameWidth>"))
pen.setWidth(s.remove("<FrameWidth>").remove("</FrameWidth>").toInt());
else if (s.contains("<LineStyle>"))
pen.setStyle(PenStyleBox::penStyle(s.remove("<LineStyle>").remove("</LineStyle>").toInt()));
else if (s.contains("<x>"))
x = s.remove("<x>").remove("</x>").toDouble();
else if (s.contains("<y>"))
y = s.remove("<y>").remove("</y>").toDouble();
else if (s.contains("<right>"))
right = s.remove("<right>").remove("</right>").toDouble();
else if (s.contains("<bottom>"))
bottom = s.remove("<bottom>").remove("</bottom>").toDouble();
else if (s.contains("<path>"))
i = g->addImage(s.remove("<path>").remove("</path>"));
else if (s.contains("<xpm>")){
save_xpm = true;
if (!i){
QString xpm;
while ( s != "</xpm>" ){
s = *(++line);
xpm += s + "\n";
}
QImage image;
if (image.loadFromData(xpm.toAscii()))
i = g->addImage(image);
}
}
}
if (i){
i->setFrameStyle(frameStyle);
i->setFramePen(pen);
i->setCoordinates(x, y, right, bottom);
i->setSaveInternally(save_xpm);
}
}
示例6: QWidget
ImagePlayer::ImagePlayer(QWidget *parent, QString name )
: QWidget(parent)
, surface(0)
, playButton(0)
, positionSlider(0)
{
connect(&movie, SIGNAL(stateChanged(QMovie::MovieState)),
this, SLOT(movieStateChanged(QMovie::MovieState)));
connect(&movie, SIGNAL(frameChanged(int)),
this, SLOT(frameChanged(int)));
ImageWidget *imageWidget = new ImageWidget( parent );
surface = imageWidget->videoSurface();
playButton = new QPushButton;
playButton->setEnabled(false);
playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
connect(playButton, SIGNAL(clicked()),
this, SLOT(play()));
positionSlider = new QSlider(Qt::Horizontal);
positionSlider->setRange(0, 0);
connect(positionSlider, SIGNAL(sliderMoved(int)),
this, SLOT(setPosition(int)));
connect(&movie, SIGNAL(frameChanged(int)),
positionSlider, SLOT(setValue(int)));
QBoxLayout *controlLayout = new QHBoxLayout;
controlLayout->setMargin(0);
//controlLayout->addWidget(openButton);
controlLayout->addWidget(playButton);
controlLayout->addWidget(positionSlider);
QBoxLayout *layout = new QVBoxLayout;
layout->addWidget( imageWidget );
layout->addLayout( controlLayout );
setLayout(layout);
//
_name = name;
openFile();
}
示例7: imgParams
Vector<Widget*> MainPage::createWidgets() {
RelativeController* plc = NULL;;
TextWidget* txt = NULL;
Button* btn = NULL;
ImageWidget* img = NULL;
RelativeControllerParams imgParams(ControllerParams::MATCH_PARENT, ControllerParams::MATCH_PARENT);
RelativeControllerParams button(ControllerParams::WRAP_CONTENT, ControllerParams::WRAP_CONTENT);
button.setRelation(RelativeControllerParams::ALIGN_PARENT_BOTTOM);
button.setRelation(RelativeControllerParams::ALIGN_PARENT_LEFT);
RelativeControllerParams text(ControllerParams::WRAP_CONTENT, ControllerParams::WRAP_CONTENT);
text.setRelation(RelativeControllerParams::CENTER_IN_PARENT);
Vector<Widget*> widgets;
for (size_t i = 0; i < 10; i++) {
plc = new RelativeController(this);
mWidgetPool.append(plc);
img = new ImageWidget(this);
mWidgetPool.append(img);
img->setImageResource(gPictures[i]);
img->setScaleType(ImageWidget::FIT_XY);
plc->addWidget(img);
img->setControllerParams(&imgParams);
txt = new TextWidget(this);
txt->setControllerParams(&text);
mWidgetPool.append(txt);
txt->setText(String::format("this is %d picture.", i + 1));
txt->setTextColor(0xffff0000);
plc->addWidget(txt);
btn = new Button(this);
btn->setControllerParams(&button);
mWidgetPool.append(btn);
btn->setText(String::format("button %d", i+1));
plc->addWidget(btn);
widgets.append(plc);
}
GLOG(LOG_TAG, LOGINFO, "widgets size %d", widgets.size());
return widgets;
}
示例8: setBestSize
void EnrichmentDialog::setBestSize()
{
ImageWidget *iw = qobject_cast<ImageWidget *>(d_widget);
if (iw){
iw->setSize(iw->pixmap().size());
displayCoordinates(unitBox->currentIndex());
d_plot->multiLayer()->notifyChanges();
return;
}
TexWidget *tw = qobject_cast<TexWidget *>(d_widget);
if (tw){
tw->setBestSize();
displayCoordinates(unitBox->currentIndex());
d_plot->multiLayer()->notifyChanges();
return;
}
}
示例9: saveImagesInternally
void EnrichmentDialog::saveImagesInternally(bool save)
{
ImageWidget *i = qobject_cast<ImageWidget *>(d_widget);
if (i)
i->setSaveInternally(boxSaveImagesInternally->isChecked());
d_plot->multiLayer()->notifyChanges();
if (save)
return;
QString fn = imagePathBox->text();
if (fn.isEmpty() || !QFile::exists(fn)){
QMessageBox::warning(d_app, tr("QtiPlot - Warning"),
tr("The file %1 doesn't exist. The image cannot be restored when reloading the project file!").arg(fn));
chooseImageFile();
}
}
示例10: tr
void EnrichmentDialog::chooseImageFile(const QString& fn)
{
ApplicationWindow *app = (ApplicationWindow *)parentWidget();
if (!app)
return;
QString path = fn;
if (path.isEmpty())
path = ApplicationWindow::getFileName(this, tr("QtiPlot - Import image from file"), app->imagesDirPath,
ApplicationWindow::imageFilter(), 0, false);
if (!path.isEmpty()){
ImageWidget *i = qobject_cast<ImageWidget *>(d_widget);
if (i && i->load(path)){
imagePathBox->setText(path);
QFileInfo fi(path);
app->imagesDirPath = fi.dirPath(true);
app->modifiedProject();
}
}
}
示例11: MceXmlWidget
void MainWindow::onShowContentSmartButtonClicked()
{
Opc::PackagePart *part = m_package->part(ui->partNameEdit->text());
if (!part)
return;
if (ui->partContentSmartButton->property("smart") == "xml") {
//Show formatted xml file contents
MceXmlWidget *edit = new MceXmlWidget(part->getDevice()->readAll());
part->releaseDevice();
edit->setAttribute(Qt::WA_DeleteOnClose);
edit->setWindowTitle(part->partName());
edit->resize(800, 600);
edit->show();
} else if (ui->partContentSmartButton->property("smart") == "image") {
//Show image
ImageWidget *edit = new ImageWidget;
edit->setAttribute(Qt::WA_DeleteOnClose);
edit->setWindowTitle(part->partName());
QImage image = QImage::fromData(part->getDevice()->readAll());
part->releaseDevice();
edit->setPixmap(QPixmap::fromImage(image));
edit->resize(800, 600);
edit->show();
}
}
示例12: main
int main(int argc, char** argv)
{
QApplication app(argc, argv);
MainWindow mw;
mw.show();
#if 0
try {
ImageSource * src;
src = new ImageSource("test.jpg");
Image img = src->getImage();
FilterManager<CpuGrayFilter> filterCPU;
filterCPU.process(img);
std::cout<< "filter CPU time:" << filterCPU.getTime().total_microseconds() <<"us"<< std::endl;
ImageWidget foo;
foo.setImage(img);
foo.setWindowTitle("Vis - CPU");
foo.show();
#ifdef USE_CUDA
Image img2 = src->getImage();
FilterManager<GpuGrayFilter> filterGPU;
filterGPU.process(img2);
std::cout<< "filter GPU time:" << filterGPU.getTime().total_microseconds()<<"us" << std::endl;
ImageWidget foo2;
foo2.setImage(img2);
foo2.setWindowTitle("Vis - GPU");
foo2.show();
#endif
} catch(IException & ex) {
std::cout <<ex.getMessage().toStdString() << std::endl;
return 1;
}
#endif
return app.exec();
}
示例13:
ImageWidget::ImageWidget(const ImageWidget& obj) : sf::Sprite(*(obj.getTexture()))
{}
示例14: displayCoordinates
void EnrichmentDialog::setWidget(QWidget *w)
{
if (!w || !d_app)
return;
d_widget = w;
FrameWidget *fw = qobject_cast<FrameWidget *>(d_widget);
if (fw){
#ifndef QT_MAC_USE_COCOA
if (d_plot)
d_plot->deselectMarker();
#endif
frameBox->blockSignals(true);
frameBox->setCurrentIndex(fw->frameStyle());
frameBox->blockSignals(false);
frameColorBtn->blockSignals(true);
frameColorBtn->setColor(fw->frameColor());
frameColorBtn->blockSignals(false);
boxFrameLineStyle->blockSignals(true);
boxFrameLineStyle->setStyle(fw->framePen().style());
boxFrameLineStyle->blockSignals(false);
boxFrameWidth->blockSignals(true);
if (d_widget_type == Ellipse)
boxFrameWidth->setValue(fw->framePen().widthF());
else
boxFrameWidth->setValue(fw->framePen().width());
boxFrameWidth->blockSignals(false);
unitBox->setCurrentIndex(d_app->d_frame_geometry_unit);
attachToBox->setCurrentIndex((int)fw->attachPolicy());
displayCoordinates(d_app->d_frame_geometry_unit);
} else {
unitBox->setCurrentIndex(FrameWidget::Pixel);
displayCoordinates(FrameWidget::Pixel);
}
if (d_widget_type == Text){
LegendWidget *l = qobject_cast<LegendWidget *>(d_widget);
if (l){
setText(textEditBox, l->text());
textFont = l->font();
QFont fnt = textFont;
fnt.setPointSize(QFont().pointSize() + 2);
textEditBox->setFont(fnt);
textColorBtn->blockSignals(true);
textColorBtn->setColor(l->textColor());
textColorBtn->blockSignals(false);
QColor bc = l->backgroundColor();
boxBackgroundTransparency->blockSignals(true);
boxBackgroundTransparency->setValue(100*bc.alphaF());
boxBackgroundTransparency->blockSignals(false);
transparencySlider->blockSignals(true);
transparencySlider->setValue(boxBackgroundTransparency->value());
transparencySlider->blockSignals(false);
textBackgroundBtn->blockSignals(true);
textBackgroundBtn->setEnabled(bc.alpha());
bc.setAlpha(255);
textBackgroundBtn->setColor(bc);
textBackgroundBtn->blockSignals(false);
boxTextAngle->blockSignals(true);
boxTextAngle->setValue(l->angle());
boxTextAngle->blockSignals(false);
autoUpdateTextBox->setChecked(l->isAutoUpdateEnabled());
texOutputBox->setChecked(l->hasTeXOutput());
updateButtons();
}
} else if (d_widget_type == Tex){
TexWidget *tw = qobject_cast<TexWidget *>(d_widget);
if (tw){
setText(equationEditor, tw->formula());
outputLabel->setPixmap(tw->pixmap());
bestSizeButton->show();
}
return;
} else if (d_widget_type == Image){
ImageWidget *i = qobject_cast<ImageWidget *>(d_widget);
if (i){
imagePathBox->setText(i->fileName());
boxSaveImagesInternally->blockSignals(true);
boxSaveImagesInternally->setChecked(i->saveInternally());
boxSaveImagesInternally->blockSignals(false);
bestSizeButton->show();
}
} else if (d_widget_type == Frame || d_widget_type == Ellipse){
QColor bc = fw->backgroundColor();
boxTransparency->blockSignals(true);
boxTransparency->setValue(100.0*bc.alphaF());
boxTransparency->blockSignals(false);
//.........这里部分代码省略.........
示例15: CommandCallback
///////////////////////////////////////////////////////////////////////////////
//
// Handle commands entered in input box.
//
///////////////////////////////////////////////////////////////////////////////
void ImageWidget::CommandCallback(Fl_Widget* pWidget, void* pData)
{
ImageWidget* pImageWidget = static_cast<ImageWidget*>(pData);
CScriptHandler::HandleCommand(static_cast<Fl_Input*>(pWidget)->value(), pImageWidget->m_pImage);
pImageWidget->Redraw();
}// CommandCallback