Skip to content

Commit

Permalink
Merge pull request KLayout#1685 from KLayout/bugfix/issue-1679
Browse files Browse the repository at this point in the history
Bugfix/issue 1679
  • Loading branch information
klayoutmatthias authored Apr 17, 2024
2 parents c6174b1 + ae2d6fb commit 6bc314a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
9 changes: 4 additions & 5 deletions src/doc/doc/programming/qt_binding.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
<li>QtXmlPatterns (Qt5): XML schema and queries</li>
<li>QtSql: database support</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>QtMultimedia (Qt5): multimedia support</li>
<li>QtPrintSupport (Qt5): print support</li>
Expand Down Expand Up @@ -244,7 +243,7 @@ end</pre>

ui_file = QFile::new(QFileInfo::new($0).dir.filePath("MyDialog.ui"))
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

def dialog.setup
Expand All @@ -260,11 +259,11 @@ end</pre>

<p>
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>
("button") and a <tt>QSlider</tt> ("slider").
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>
Expand Down Expand Up @@ -312,7 +311,7 @@ end</pre>
</p>

<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)
# this is correct:
b.is_a?(QPushButton_Native)</pre>
Expand Down
2 changes: 1 addition & 1 deletion src/lay/lay/macro_templates/qt_designer.lym
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# Initially we use the sample file provided as resource
ui_file = QFile::new(":/macro-templates/qt_designer.ui")
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

def dialog.setup
Expand Down
2 changes: 1 addition & 1 deletion src/lay/lay/macro_templates/qt_designer_python.lym
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import types

ui_file = pya.QFile(":/macro-templates/qt_designer.ui")
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()

# Install an event handler for the button clicked event
Expand Down
2 changes: 1 addition & 1 deletion src/lay/lay/macro_templates/qt_dialog.lym
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
layout.addWidget(@image)

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)

button.clicked do
Expand Down
2 changes: 1 addition & 1 deletion src/lay/lay/macro_templates/qt_dialog_python.lym
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ScreenshotDialog(pya.QDialog):
layout.addWidget(self.image)

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)

# attach the event handler
Expand Down

0 comments on commit 6bc314a

Please sign in to comment.