Merge pull request #1685 from KLayout/bugfix/issue-1679

Bugfix/issue 1679
This commit is contained in:
Matthias Köfferlein 2024-04-17 22:38:17 +02:00 committed by GitHub
commit 6bc314a6cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 8 additions and 9 deletions

View File

@ -29,7 +29,6 @@
<li>QtXmlPatterns (Qt5): XML schema and queries</li> <li>QtXmlPatterns (Qt5): XML schema and queries</li>
<li>QtSql: database support</li> <li>QtSql: database support</li>
<li>QtNetwork: various network protocols and supporting classes</li> <li>QtNetwork: various network protocols and supporting classes</li>
<li>QtDesigner: dynamically load designer files (.ui)</li>
<li>QtUiTools: dynamically load designer files (.ui)</li> <li>QtUiTools: dynamically load designer files (.ui)</li>
<li>QtMultimedia (Qt5): multimedia support</li> <li>QtMultimedia (Qt5): multimedia support</li>
<li>QtPrintSupport (Qt5): print support</li> <li>QtPrintSupport (Qt5): print support</li>
@ -244,7 +243,7 @@ end</pre>
ui_file = QFile::new(QFileInfo::new($0).dir.filePath("MyDialog.ui")) ui_file = QFile::new(QFileInfo::new($0).dir.filePath("MyDialog.ui"))
ui_file.open(QIODevice::ReadOnly) ui_file.open(QIODevice::ReadOnly)
dialog = QFormBuilder::new.load(ui_file, Application::instance.main_window) dialog = QUiLoader::new.load(ui_file, Application::instance.main_window)
ui_file.close ui_file.close
def dialog.setup def dialog.setup
@ -260,11 +259,11 @@ end</pre>
<p> <p>
This sample tries to locate a designer file called "<tt>MyDialog.ui</tt>" relative to the This sample tries to locate a designer file called "<tt>MyDialog.ui</tt>" relative to the
macro's path (in <tt>$0</tt>). It uses the <class_doc href="QFormBuilder"/> class to load and macro's path (in <tt>$0</tt>). It uses the <class_doc href="QUiLoader"/> class to load and
create the dialog. In that sample, "<tt>MyDialog</tt>" defines a dialog with two widgets: a <tt>QPushButton</tt> create the dialog. In that sample, "<tt>MyDialog</tt>" defines a dialog with two widgets: a <tt>QPushButton</tt>
("button") and a <tt>QSlider</tt> ("slider"). ("button") and a <tt>QSlider</tt> ("slider").
Because of the dynamic binding in Ruby, "dialog" will already have the correct class and Because of the dynamic binding in Ruby, "dialog" will already have the correct class and
we don't have to cast the pointer delivered by <tt>QFormBuilder::load</tt> before we can call "exec". we don't have to cast the pointer delivered by <tt>QUiLoader::load</tt> before we can call "exec".
</p> </p>
<p> <p>
@ -312,7 +311,7 @@ end</pre>
</p> </p>
<pre>b = dialog.button <pre>b = dialog.button
# this will not render true, if the button was created by QFormBuilder for example # this will not render true, if the button was created by QUiLoader for example
b.is_a?(QPushButton) b.is_a?(QPushButton)
# this is correct: # this is correct:
b.is_a?(QPushButton_Native)</pre> b.is_a?(QPushButton_Native)</pre>

View File

@ -20,7 +20,7 @@
# Initially we use the sample file provided as resource # Initially we use the sample file provided as resource
ui_file = QFile::new(":/macro-templates/qt_designer.ui") ui_file = QFile::new(":/macro-templates/qt_designer.ui")
ui_file.open(QIODevice::ReadOnly) ui_file.open(QIODevice::ReadOnly)
dialog = QFormBuilder::new.load(ui_file, Application::instance.main_window) dialog = QUiLoader::new.load(ui_file, Application::instance.main_window)
ui_file.close ui_file.close
def dialog.setup def dialog.setup

View File

@ -17,7 +17,7 @@ import types
ui_file = pya.QFile(":/macro-templates/qt_designer.ui") ui_file = pya.QFile(":/macro-templates/qt_designer.ui")
ui_file.open(pya.QIODevice.ReadOnly) ui_file.open(pya.QIODevice.ReadOnly)
form = pya.QFormBuilder().load(ui_file, pya.Application.instance().main_window()) form = pya.QUiLoader().load(ui_file, pya.Application.instance().main_window())
ui_file.close() ui_file.close()
# Install an event handler for the button clicked event # Install an event handler for the button clicked event

View File

@ -32,7 +32,7 @@
layout.addWidget(@image) layout.addWidget(@image)
button = QPushButton.new('Screenshot', self) button = QPushButton.new('Screenshot', self)
button.setFont(QFont.new('Times', 18, QFont::Bold)) button.setFont(QFont.new('Times', 18, QFont::Bold.to_i))
layout.addWidget(button) layout.addWidget(button)
button.clicked do button.clicked do

View File

@ -49,7 +49,7 @@ class ScreenshotDialog(pya.QDialog):
layout.addWidget(self.image) layout.addWidget(self.image)
button = pya.QPushButton('Screenshot', self) button = pya.QPushButton('Screenshot', self)
button.setFont(pya.QFont('Times', 18, pya.QFont.Bold)) button.setFont(pya.QFont('Times', 18, int(pya.QFont.Bold)))
layout.addWidget(button) layout.addWidget(button)
# attach the event handler # attach the event handler