<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Validating a dateEdit and a Label]]></title><description><![CDATA[<p dir="auto">Hi,<br />
I have written a function to validate a  dateEdit and a Label which displays an image.  I don't know what I'm doing wrong, I would appreciate assistance. Thank you. Below are my lines.</p>
<pre><code>self.ui.PushButton.clicked.connect(self.my_func)

def my_func(self):
      
    dob = self.ui.Date_of_Birth_dateEdit.date().toString()
    pixmap = QPixmap(self.fname)
    self.ui.Display_label.setPixmap(QPixmap(pixmap))  

    if dob == '':
       QMessageBox.information(self, "Error", "Select Date Of Birth")
       self.ui.Date_of_Birth_dateEdit.setFocus()

 elif  self.ui.Display_label.setPixmap(QPixmap(pixmap)) == ' ':
       self.ui.Display_label.setFocus()

 else:
       self.ui.stackedWidget.setCurrentWidget(self.ui.Page_one)
</code></pre>
]]></description><link>https://forum.qt.io/topic/132275/validating-a-dateedit-and-a-label</link><generator>RSS for Node</generator><lastBuildDate>Wed, 16 Sep 2026 08:34:39 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/132275.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 24 Nov 2021 13:20:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Validating a dateEdit and a Label on Wed, 24 Nov 2021 15:52:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lt-k101">@<bdi>LT-K101</bdi></a> said in <a href="/post/691553">Validating a dateEdit and a Label</a>:</p>
<blockquote>
<pre><code>dob = self.ui.Date_of_Birth_dateEdit.date().toString()
...
if dob == '':
</code></pre>
</blockquote>
<p dir="auto">Did you check to see whether this can ever return the <code>''</code> empty string?  I don't think it can.</p>
<blockquote>
<p dir="auto">if the user leave a field empty</p>
</blockquote>
<p dir="auto">Could you explain how the user gets to leave a <code>QDateEdit</code> empty?  I don't think he can.</p>
]]></description><link>https://forum.qt.io/post/691592</link><guid isPermaLink="true">https://forum.qt.io/post/691592</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Wed, 24 Nov 2021 15:52:04 GMT</pubDate></item><item><title><![CDATA[Reply to Validating a dateEdit and a Label on Wed, 24 Nov 2021 14:45:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a> I want to prompt the user, if the user leave a field empty and want to move to the next page by clicking on a Qpushbutton. The App should display a message using a Qmessagebox and setfocus on the empty field so the user will know the exact field which is empty. I used same logic for QLineEdit and it works fine but for QdateEdit and QLabel it does not work.</p>
]]></description><link>https://forum.qt.io/post/691579</link><guid isPermaLink="true">https://forum.qt.io/post/691579</guid><dc:creator><![CDATA[LT-K101]]></dc:creator><pubDate>Wed, 24 Nov 2021 14:45:49 GMT</pubDate></item><item><title><![CDATA[Reply to Validating a dateEdit and a Label on Wed, 24 Nov 2021 13:23:59 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lt-k101">@<bdi>LT-K101</bdi></a> said in <a href="/post/691553">Validating a dateEdit and a Label</a>:</p>
<blockquote>
<p dir="auto">I don't know what I'm doing wrong</p>
</blockquote>
<p dir="auto">And I don't know what the problem is...<br />
Also, what does "validate" mean here?<br />
Can you please explain what you want to do and what does not work?</p>
]]></description><link>https://forum.qt.io/post/691554</link><guid isPermaLink="true">https://forum.qt.io/post/691554</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Wed, 24 Nov 2021 13:23:59 GMT</pubDate></item></channel></rss>