Hi Emmanuel
There is not much wrong with your code below, but I believe you always need to create widgets like QLabels (our EPICS flavor or otherwise) within a main window widget.
Also, the CA connection is not established automatically, you have to call the 'activate()' method once the widget is created.
Calling 'activate()' is a minor overhead that I would like to avoid for simple widgets that could otherwise just 'go' but allows for widgets that take multiple PVs and then require macro substitution to be applied to those PVs.
Below is your code with the following changes:
1) required: A QMainWindow is created to contain the QCaLabel widget
2) required: The QCaLabel::activate() method is called.
3) just for fun: The QLabel::setFrameShape() method is called to ensure something is visible even if the text displayed is a blank string.
4) required: The 'QWidget::show()' method is called for the QMainWindow rather than the QCaLabel
I hope this helps,
Andrew
#include <QApplication>
#include <QMainWindow>
#include <QCaLabel.h>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QMainWindow* mainW = new QMainWindow;
QCaLabel* label = new QCaLabel( "DMC2183:1:DscrptnSI", mainW );
// Ensure the something of the label is visible, even if it contains no text, (just for testing)
label->setFrameShape(QFrame::Box);
// Establish CA connection
// This does not happen automatically to allow PV name macro substitutions to be performed.
// (Perhaps this should not be required when passing a PV on construction?)
label->activate();
mainW->show();
return a.exec();
}
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of [email protected]
Sent: Tuesday, 22 March 2011 8:46 AM
To: EPICS tech-talk
Subject: epicsqt first try
----- Forwarded message from [email protected] -----
Date: Wed, 16 Mar 2011 17:26:16 -0700
From: [email protected]
To: "Andrew Rhyder (epicsqt)" <[email protected]>,
EPICS tech-talk <[email protected]>
Cc: Emmanuel Mayssat <[email protected]>
Subject: epicsqt first try
Andrew Rhyder,
I am testing your epicsqt package.
I may be interested in wrapping it in SIP so that your libraries can
be used in python (which i use heavily)
But before I do so, I am trying to test your Qt designer plugin.
First, I would like to use a simple QCaLabel object.
$ cat main.cpp
#include <QApplication>
#include <QCaLabel.h>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QCaLabel label("DMC2183:1:DscrptnSI");
label.show();
return a.exec();
}
I have
$ caget DMC2183:1:DscrptnSI
DMC2183:1:DscrptnSI OC:C50-C70-C90
I compile without any errors....
I start the program...
and I don't see anything ;-(
I assume that QCaLabel can be used to display the content of a string PV. What am I doing wrong?
Regards,
--
Emmanuel
----- End forwarded message -----
--
Emmanuel
<br>This message and any attachments may contain proprietary or confidential information. If you are not the intended recipient or you received the message in error, you must not use, copy or distribute the message. Please notify the sender immediately and destroy the original message. Thank you.
- Replies:
- Re: epicsqt first try emmanuel_mayssat
- References:
- epicsqt first try emmanuel_mayssat
- Navigate by Date:
- Prev:
epicsqt first try emmanuel_mayssat
- Next:
waveform transformation emmanuel_mayssat
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
<2011>
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
epicsqt first try emmanuel_mayssat
- Next:
Re: epicsqt first try emmanuel_mayssat
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
<2011>
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|