text label is not a member of 'Ui::Dialog' Qt - image

I am attempting to place an image in a label in my openCV code. The opencv part works swimmingly. However, displaying the Qimage is proving to be a problem. I am placing the image in the label as such.
ui->lblOriginal->setPixmap(QPixmap::fromImage(qimgOriginal));
However, it is telling me that "error: C2039: 'lblOriginal' : is not a member of 'Ui::Dialog'"
lblOriginal is a label in my dialog. Is there something I am missing? This is the entire code in dialog.cpp:
#include "dialog.h"
#include "ui_dialog.h"
Dialog::Dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
ui->setupUi(this);
capWebcam.open(0);
tmrTimer = new QTimer(this);
connect(tmrTimer, SIGNAL(timeout()), this, SLOT(processAndUpdateGUI()));
tmrTimer->start(20);
}
Dialog::~Dialog()
{
delete ui;
}
void Dialog::processAndUpdateGUI(){
capWebcam >> matOriginal;
if(matOriginal.empty() == true)return;
cv::cvtColor(matOriginal,matOriginal, CV_BGR2RGB);
QImage qimgOriginal((uchar*)matOriginal.data, matOriginal.cols, matOriginal.rows,matOriginal.step,QImage::Format_RGB888);
ui->lblOriginal->setPixmap(QPixmap::fromImage(qimgOriginal));
}
The us xml file is below.
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1181</width>
<height>590</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QLabel" name="lblOrignal">
<property name="geometry">
<rect>
<x>80</x>
<y>36</y>
<width>640</width>
<height>480</height>
</rect>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

Actually you are making a basic mistake, in your UI fle you have:
<widget class="QLabel" name="lblOrignal">
and your trying to reference as:
ui->lblOriginal->setPixmap(QPixmap::fromImage(qimgOriginal));
So have you checked the difference ? if not lblOrignal is not equals to lblOriginal.

Related

Spring batch JdbcPaging Item Reader with multiple table joins

Need to implement paginating for an spring batch application. The Query has multiple join, Guide for an effective Pagining query, with existing table model can this join be effectively written to pagination where "ED_EMP_LOGIN_STATE" is the filter where other tables are select. running this query is still slow and look likes paginzation with rownnum condition does not show any impact on execution plan.
How this query can be modified to pass in spring batch paginzation reader
<bean id="empItemReader" class="org.springframework.batch.item.database.JdbcPagingItemReader" scope="step">
<property name="dataSource" ref="empDataSource" />
<property name="rowMapper">
<bean class="org.sample.model.EmployeeMapper" />
</property>
<property name="queryProvider">
<bean class="org.springframework.batch.item.database.support.SqlPagingQueryProviderFactoryBean">
<property name="dataSource" ref="empDataSource" />
<property name="sortKeys">
<map>
<entry key="ID" value="ASCENDING"/>
</map>
</property>
<!-- Intentionally put sort key second in the query list as a test -->
<property name="selectClause" >
<value>
<![CDATA[
emp_task_sub_details.DEP_NAME AS DEP_NAME
,emp_task_sub_details.EmpName AS EmpName
,emp_task_sub_details.EmpFirstName AS EmpFirstName
,emp_task_sub_details.EmpIDCard AS EmpIDCard
,emp_task_sub_details.EmpBuilding AS EmpBuilding
,emp_task_sub_details.EmpLocation EmpLocation ENV_CAT
,emp_task_sub_details.NAME AS NAME
,ed_parent_join.task_name AS TASK_NAME
,ed_parent_join.start_time AS TASK_NAME_START_TIME
,ed_parent_join.finish_time AS TASK_NAME_END_TIME
,emp_task_sub_details.STATUS AS STATUS
,emp_task_sub_details.STATE_ID AS ID
]]>
</value>
</property>
<property name="fromClause">
<value>
<![CDATA[
ED_EMP_LOGIN_STATE ed_parent_join
JOIN (
select
ed_dep.name as DEP_NAME
,empName_code_prop.string as EmpName
,empfirst_code_prop.string as EmpFirstName
,id_code_prop.string as EmpIDCard
,build_code_prop.string as EmpBuilding
,loc_code_prop.string as EmpLocation
,ed_emp.name as NAME
,ed_emp_lg_st.id as STATE_ID
,ed_emp_tas_wk.STATUS AS STATUS
from
ED_DEPARTMENT ed_dep
,ED_EMPLOYEE ed_emp
,ed_emp_tas_wkK ed_emp_tsk
,ED_EMP_LOGIN ed_emp_lg
,ED_EMP_LOGIN_STATE ed_emp_lg_st
,ED_EMP_LOGIN_WORK ed_emp_tas_wk
,ED_TASK_PROPS empName_code_prop
,ED_TASK_PROPS empfirst_code_prop
,ED_TASK_PROPS id_code_prop
,ED_TASK_PROPS build_code_prop
,ED_TASK_PROPS loc_code_prop
,ED_ACTIVITY ed_act
,ED_LOCATION ed_loc
where
ed_emp.id = ed_dep.id
and ed_emp.tsk_id = ed_emp_tsk.id
and ed_emp_lg.tsk_id = ed_emp_tsk.id
and ed_emp_lg_st.parent_emp_id = ed_emp_lg.id
and ed_emp_tas_wk.state_id = ed_emp_lg_st.id
and ed_emp_lg.prop_id = empName_code_prop.parent_prop_id
and empName_code_prop.name = 'EmpName'
and ed_emp_lg.prop_id = empfirst_code_prop.parent_prop_id
and empfirst_code_prop.name = 'EmpFirstName'
and ed_emp_lg.prop_id = id_code_prop.parent_prop_id
and id_code_prop.name = 'EmpIDCard'
and ed_emp_lg.prop_id = build_code_prop.parent_prop_id
and build_code_prop.name = 'EmpBuilding'
and ed_emp_tas_wk.JOB_ID = ed_act.id
and ed_act.environment_name = ed_loc.name
and ed_loc.prop_id = loc_code_prop.parent_prop_id
and loc_code_prop.name = 'EmpLocation') emp_task_sub_details
ON emp_task_sub_details.STATE_ID = ed_parent_join.id
]]>
</value>
</property>
<property name="whereClause">
<value>
<![CDATA[
ed_parent_join.start_time >= :startTime
and ed_parent_join.finish_time < :finishTime
]]>
</value>
</property>
</bean>
</property>
<property name="pageSize" value="${loadPageCommitSize}" />
<property name="parameterValues">
<map>
<entry key="startTime" value="#{jobParameters[StartTime]}" />
<entry key="finishTime" value="#{jobParameters[FinishTime]}" />
</map>
</property>
</bean>

Add entry to dictionary in child object

How is it possible to add entry to dictionary, defined in parent object, from the child object?
*UPDATED
I edit my config as follows:
<object id="ParentType" singleton="false" type="SomeType">
<property name="FieldNameMap">
<dictionary key-type="string" value-type="string" >
<entry key="Title" value="TitleName"/>
</dictionary>
</property>
</object>
<object id="ChildType" singleton="false" type="SomeType" parent="ParentType">
<property name="FieldNameMap">
<dictionary merge="true">
<!-- this entry should be added to, not replace the whole Dictionary -->
<entry key="Position" value="PositionName"/>
</dictionary>
</property>
</object>
but, unfortunately, it now throws cast exception:
Cannot convert property value of type
[System.Collections.Specialized.HybridDictionary] to required type
[System.Collections.Generic.IDictionary`2[[System.String,
],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]]
I haven't tried this myself, but according to the docs, spring.net will use the Add method of the collection to add items, if the collection itself is exposed as a readonly property.
So it might be possible to use object definition inheritance to achieve the behavior you describe. Config will be something like:
<object id="ParentType" singleton="false" type="SomeType"
abstract="true">
<property name="FieldNameMap">
<dictionary>
<entry key="Title" value="TitleName"/>
</dictionary>
</property>
</object>
<object id="ChildType" singleton="false" type="SomeType"
parent="ParentType">
<property name="FieldNameMap">
<dictionary>
<!-- this entry should be added to, not replace the whole Dictionary -->
<entry key="Position" value="PositionName"/>
</dictionary>
</property>
</object>
This will only work if FieldNameMap is a readonly property.

Including dynamic images in a PDF with BIRT

I am trying to use BIRT 2.5.0 to generate a pdf file. BIRT is called from pHp (this is done thanks to JavaBridge and a Tomcat server).
And I am simply trying to create a checkbox, checked under certain conditions.
I looked a bit on the internet and found 2 different ways to do it.
The first way is to play with the Visibility if the field "idclassebillet" (on which I am making the test) has a value of 1. I did it this way :
<image id="9010">
<list-property name="visibility">
<structure>
<property name="format">all</property>
<expression name="valueExpr" type="javascript">row["classEq1"]</expression>
</structure>
</list-property>
<list-property name="boundDataColumns">
<structure>
<property name="name">classEq1</property>
<text-property name="displayName">classEq1</text-property>
<expression name="expression" type="javascript">dataSetRow["idclassebillet"] == 1</expression>
<property name="dataType">boolean</property>
</structure>
</list-property>
<property name="source">embed</property>
<property name="imageName">checkbox_unchecked.png</property>
</image>
But this doesn't work.
So the second solution that I found was to play with a simple URL. This solution is much more convenient, but doesn't work neither. This would looks like that.
<image id="9018">
<property name="source">url</property>
<list-property name="boundDataColumns">
<structure>
<property name="name">classEq1</property>
<text-property name="displayName">classEq1</text-property>
<expression name="expression" type="javascript">dataSetRow["idclassebillet"]</expression>
<property name="dataType">integer</property>
</structure>
</list-property>
<expression name="uri" type="javascript">
if(row["classEq1"] == 1)
"http://my.server.com/checkbox_checked.png"+row["classEq1"];
else
"http://my.server.com/checkbox_unchecked.png"+row["classEq1"];
</expression>
</image>
In both cases, I declare the field "dataSetRow["idfield"]" like that :
<data-sets>
<oda-data-set extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet" name="infoBordereau" id="178">
<structure name="cachedMetaData">
<list-property name="resultSet">
...
<structure>
<property name="position">9</property>
<property name="name">idclassebillet</property>
<property name="dataType">integer</property>
</structure>
...
</structure>
<property name="dataSource">GestionBillet</property>
<list-property name="resultSet">
...
<structure>
<property name="position">8</property>
<property name="name">idclassebillet</property>
<property name="nativeName">idclassebillet</property>
<property name="dataType">integer</property>
</structure>
...
</list-property>
....
</oda-data-set>
</data-sets>
I checked that I can access to the content of "idclassebillet". If I simply print it this way, it works fine :
<data id="90060001">
<property name="whiteSpace">nowrap</property>
<property name="dataSet">infoBordereau</property>
<list-property name="boundDataColumns">
<structure>
<property name="name">classEq1</property>
<text-property name="displayName">classEq1</text-property>
<expression name="expression" type="javascript">dataSetRow["idclassebillet"]</expression>
<property name="dataType">integer</property>
</structure>
</list-property>
<property name="resultSetColumn">classEq1</property>
</data>
And whatever the solution I choose to get my "dynamic" images, I always get the same image, whatever the value of "dataSetRow["idclassebillet"]" is.
I have no problem accessing and printing the image. The problem is more to "test" the value of the "idclassebillet" field (ie. how can I access this field ?).
I hope that you understand what I am trying to do. If you have a better solution (and if possible an example of working code), don't hesitate to share ^^ :)
Many thanks,
Raphaƫl POITTEVIN
NB : At first, I wanted my images to be embedded in the document (this what I use in the first solution), but as this didn't worked, I used an images hosted on http://my.server.com ...
If your objective is to display an unchecked/checked checkbox, have you considered using the Wingdings font with characters 0xA8 and 0xFD or 0xFE?

Referencing specific element(s) in a RelaxNG schema with externalRef

So I have one RelaxNG schema that references another:
<define name="review">
<element name="review">
<externalRef href="other.rng"/>
</element>
</define>
other.rng:
<start>
<choice>
<ref name="good"/>
<ref name="bad"/>
</choice>
</start>
<define name="good">
<element name="good"/>
</define>
<define name="bad">
<element name="bad"/>
</define>
Is there any way I can import only <good>, but not allow <bad>? The goal being:
<review><good/></review>: valid
<review><bad/></review>: invalid
The grammar you import with externalRef can't be modified. To achieve the kind of validation you're after, I see this method :
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<include href="other.rng">
<start combine="choice">
<ref name="review"/>
</start>
</include>
<define name="review">
<element name="review">
<ref name="good"/>
</element>
</define>
</grammar>
You include the other schema.
You override the start element in the include (good and bad elements won't be possible root).
The specification says :
If the include element has a start component, then all start
components are removed from the grammar element.
You make a reference to the good element in your review definition.

How to extract only data matching string in Xpath

When Xpath expression is applied on /data/title , the results displayed are 'All the connections', 'Forward Details', 'Forward Detail',''Forward Detail', 'Forward Details' , 'ABCD', ...e.t.c..
My xpath expression has to list only if the /title is 'Forward Detail' or ''Forward Details'...
<?xml version="1.0" encoding="UTF-8"?>
<data>
<title>All the connections</title>
<List>
<Listitem>
<Price>P9909</Price>
</Listitem>
</List>
<title>Forward Detail</title>
<List>
<Listitem>
<Price>P45</Price>
</Listitem>
<Listitem>
<Price>P98</Price>
</Listitem>
<Listitem>
<Price>P68</Price>
</Listitem>
</List>
<title>Forward Details</title>
<List>
<Listitem>
<Price>P452</Price>
</Listitem>
<Listitem>
<Price>P983</Price>
</Listitem>
</List>
<title>Forward Detail</title>
<List>
<Listitem>
<Price>P4501</Price>
</Listitem>
<Listitem>
<Price>P909</Price>
</Listitem>
<Listitem>
<Price>P899</Price>
</Listitem>
</List>
<title>Forward Details</title>
<List>
<Listitem>
<Price>P4522</Price>
</Listitem>
<Listitem>
<Price>P98311</Price>
</Listitem>
</List>
of this input, I have to extract the price of only 'Forward Detail' and 'Forward Details'. I have to ignore the rest.
Please help me in framing the Xpath for this. I am using Xpath 1.0
Thanks
Ramm
Try if next command works for you:
/data/title[text() = "Forward Detail" or text() = "Forward Details"]/following-sibling::*[1]/descendant::Price
My result:
<Price>P45</Price>
<Price>P98</Price>
<Price>P68</Price>
<Price>P452</Price>
<Price>P983</Price>
<Price>P4501</Price>
<Price>P909</Price>
<Price>P899</Price>
<Price>P4522</Price>
<Price>P98311</Price>
You need a condition. Something like /data/title[text() == 'Forward Detail'].
However I suspect you actually need the List that is preceded by given title, right? Your XML is badly designed for that (it should have the title inside the <List> element instead), but XPath is capable enough to cope. You need to look at the sibling axis and the pos() function.
I'd have to look in the documentation myself, so I am just making this a community wiki; anybody feel free to rewrite.

Resources