mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 08:58:37 +00:00
uic: support QTabWidget.title, QDockWidget locations
This commit is contained in:
parent
18e30eaf70
commit
7de20812b2
@ -82,11 +82,24 @@ func generateWidget(w UiWidget, parentName string, parentClass string) (string,
|
|||||||
ret.WriteString(`ui.` + w.Name + setterFunc + `(qt.` + strings.Replace(*prop.EnumVal, `::`, `__`, -1) + ")\n")
|
ret.WriteString(`ui.` + w.Name + setterFunc + `(qt.` + strings.Replace(*prop.EnumVal, `::`, `__`, -1) + ")\n")
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ret.WriteString("/* miqt-uic: no handler for property '" + prop.Name + "' */\n")
|
ret.WriteString("/* miqt-uic: no handler for " + w.Name + " property '" + prop.Name + "' */\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes
|
// Attributes
|
||||||
|
|
||||||
|
for _, attr := range w.Attributes {
|
||||||
|
if parentClass == "QTabWidget" && attr.Name == "title" {
|
||||||
|
ret.WriteString(parentName + `.SetTabText(` + parentName + ".IndexOf(ui." + w.Name + "), " + generateString(attr.StringVal, parentClass) + ")\n")
|
||||||
|
|
||||||
|
} else if w.Class == "QDockWidget" && parentClass == "QMainWindow" && attr.Name == "dockWidgetArea" {
|
||||||
|
ret.WriteString(parentName + `.AddDockWidget(qt.DockWidgetArea(` + *attr.NumberVal + `), ui.` + w.Name + `)` + "\n")
|
||||||
|
|
||||||
|
} else {
|
||||||
|
ret.WriteString("/* miqt-uic: no handler for " + w.Name + " attribute '" + attr.Name + "' */\n")
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
// TODO
|
// TODO
|
||||||
// w.Attributes
|
// w.Attributes
|
||||||
|
|
||||||
|
@ -117,6 +117,7 @@ func NewMainWindowUi() *MainWindowUi {
|
|||||||
|
|
||||||
ui.dockWidget = qt.NewQDockWidget5(ui.MainWindow.QWidget)
|
ui.dockWidget = qt.NewQDockWidget5(ui.MainWindow.QWidget)
|
||||||
ui.dockWidget.SetObjectName("dockWidget")
|
ui.dockWidget.SetObjectName("dockWidget")
|
||||||
|
ui.MainWindow.AddDockWidget(qt.DockWidgetArea(1), ui.dockWidget)
|
||||||
|
|
||||||
ui.dockWidgetContents = qt.NewQWidget2(ui.dockWidget.QWidget)
|
ui.dockWidgetContents = qt.NewQWidget2(ui.dockWidget.QWidget)
|
||||||
ui.dockWidgetContents.SetObjectName("dockWidgetContents")
|
ui.dockWidgetContents.SetObjectName("dockWidgetContents")
|
||||||
@ -140,10 +141,12 @@ func (ui *MainWindowUi) Retranslate() {
|
|||||||
ui.action_New.SetText(qt.QMainWindow_Tr("&New..."))
|
ui.action_New.SetText(qt.QMainWindow_Tr("&New..."))
|
||||||
ui.actionE_xit.SetText(qt.QMainWindow_Tr("E&xit"))
|
ui.actionE_xit.SetText(qt.QMainWindow_Tr("E&xit"))
|
||||||
ui.actionE_xit.SetShortcut(qt.NewQKeySequence2(qt.QMainWindow_Tr("Ctrl+Q")))
|
ui.actionE_xit.SetShortcut(qt.NewQKeySequence2(qt.QMainWindow_Tr("Ctrl+Q")))
|
||||||
|
ui.tabWidget.SetTabText(ui.tabWidget.IndexOf(ui.tab), qt.QTabWidget_Tr("Tab 1"))
|
||||||
ui.label.SetText(qt.QWidget_Tr("Dropdown:"))
|
ui.label.SetText(qt.QWidget_Tr("Dropdown:"))
|
||||||
ui.comboBox.SetItemText(0, qt.QComboBox_Tr("First"))
|
ui.comboBox.SetItemText(0, qt.QComboBox_Tr("First"))
|
||||||
ui.comboBox.SetItemText(1, qt.QComboBox_Tr("Second"))
|
ui.comboBox.SetItemText(1, qt.QComboBox_Tr("Second"))
|
||||||
ui.label_2.SetText(qt.QWidget_Tr("Number:"))
|
ui.label_2.SetText(qt.QWidget_Tr("Number:"))
|
||||||
|
ui.tabWidget.SetTabText(ui.tabWidget.IndexOf(ui.tab_2), qt.QTabWidget_Tr("Tab 2"))
|
||||||
ui.menu_File.SetTitle(qt.QMenuBar_Tr("&File"))
|
ui.menu_File.SetTitle(qt.QMenuBar_Tr("&File"))
|
||||||
ui.dockWidget.SetWindowTitle(qt.QMainWindow_Tr("Dock Title"))
|
ui.dockWidget.SetWindowTitle(qt.QMainWindow_Tr("Dock Title"))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user