Donggyu1998

Untitled

Jun 8th, 2021
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. import QtQuick 2.10
  2. import QtQuick.Window 2.10
  3. import QtQuick.Controls 2.3
  4.  
  5. ApplicationWindow{
  6. visible: true;
  7. width: 1280;
  8. height: 720;
  9. Row {
  10. anchors.fill: parent;
  11. TabBar {
  12. id: tabBar
  13.  
  14. currentIndex: 0
  15. width: parent.width - addButton.width - btnDelete.width
  16.  
  17. TabButton { text: "TabButton" }
  18. }
  19.  
  20. Component {
  21. id: tabButton
  22. TabButton { text: "TabButton" }
  23. }
  24.  
  25. Button {
  26. id: addButton
  27. text: "+"
  28. flat: true
  29. onClicked: {
  30. tabBar.addItem(tabButton.createObject(tabBar))
  31. console.log("added:", tabBar.itemAt(tabBar.count - 1))
  32. }
  33. }
  34.  
  35. Button {
  36. id: btnDelete
  37. text: "-"
  38. flat: true
  39. onClicked: {
  40. tabBar.removeItem(tabBar.itemAt(tabBar.count-1));
  41. }
  42. }
  43. }
  44.  
  45. }
Add Comment
Please, Sign In to add comment