Results 1 to 6 of 6

Thread: table right to left

  1. #1
    Join Date
    Oct 2015
    Posts
    46
    Thanks
    19
    Platforms
    Windows

    Default table right to left

    hello
    I want my table right to left .
    This is my table.
    table4.png
    I want to be like this.
    table3.png
    Thank you

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: table right to left

    Which value do you get from Qt.application.layoutDirection?

    Cheers,
    _

  3. #3
    Join Date
    Oct 2015
    Posts
    46
    Thanks
    19
    Platforms
    Windows

    Default Re: table right to left

    my code:
    Qt Code:
    1. import QtQuick 2.0
    2. import QtQuick.Controls 1.2
    3. import QtQml.Models 2.1
    4.  
    5. Rectangle {
    6. id: root
    7. width: 205
    8. anchors.right: parent.right
    9. TableView {
    10. id: tableROList
    11. TableViewColumn{ role: "name" ; title: "نام" ; width: 100 }
    12. TableViewColumn{ role: "lastname" ; title: "نام خانوادگی" ; width: 100 }
    13. model: modelROList
    14. width: root.width
    15. }
    16. ListModel {
    17. id: modelROList
    18. ListElement{ name: "اسم اول" ; lastname: "فاملی اول" }
    19. ListElement{ name: "اسم دوم" ; lastname: "فامیلی دوم" }
    20. ListElement{ name: "اسم سوم" ; lastname: "فامیلی سوم" }
    21. }
    22. }
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Oct 2015
    Posts
    46
    Thanks
    19
    Platforms
    Windows

    Default Re: table right to left

    under codes :
    Qt Code:
    1. import QtQuick 2.0
    2. import QtQuick.Controls 1.0
    3. Rectangle {
    4. id:kol
    5. width: 360
    6. height: 360
    7.  
    8. Rectangle {
    9. id:mos
    10. width: 360
    11. height: 360
    12. anchors.centerIn: parent
    13.  
    14. ListModel {
    15. id: dataModel
    16. ListElement {
    17. color: "آبی"
    18. text: "اول"
    19. }
    20. ListElement {
    21. color: "قرمز"
    22. text: "دوم"
    23. }
    24. ListElement {
    25. color: "سبز"
    26. text: "سوم"
    27. }
    28. ListElement {
    29. color: "زرد"
    30. text: "چهارم"
    31. }
    32. }
    33.  
    34. TableView {
    35. id: view
    36. model: dataModel
    37. anchors.fill: parent
    38.  
    39. TableViewColumn {
    40. width: 100
    41. title: "رنگ"
    42. role: "color"
    43.  
    44. }
    45. TableViewColumn {
    46. width: 100
    47. title: "متن"
    48. role: "text"
    49. }
    50.  
    51. itemDelegate: Item {
    52. Text {
    53. anchors.right: parent.right
    54. // renderType: Text.NativeRendering
    55. text: styleData.value
    56. }
    57.  
    58. }
    59. }
    60. }
    61. }
    To copy to clipboard, switch view to plain text mode 

    After the run
    table5.png

  5. #5
    Join Date
    Oct 2015
    Posts
    46
    Thanks
    19
    Platforms
    Windows

    Default Re: table right to left

    The problem was solved But does not change the height of the row.
    Qt Code:
    1. import QtQuick 2.3
    2. import QtQuick.Window 2.2
    3. import QtQuick.Controls 1.2
    4. import QtQuick.Controls.Styles 1.2
    5.  
    6. Window {
    7. id: win
    8. width: 400
    9. height: 360
    10. visible: true
    11.  
    12. Rectangle {
    13. id:mos
    14. width: 400
    15. height: 360
    16. anchors.centerIn: parent
    17.  
    18. ListModel {
    19. id: libraryModel
    20.  
    21. ListElement {
    22. name: "نام اول"
    23. lastname: "فامیلی اول"
    24. }
    25. ListElement {
    26. name: "نام دوم"
    27. lastname: "فامیلی دوم"
    28. }
    29. ListElement {
    30. name: "نام سوم"
    31. lastname: "فامیلی سوم"
    32. }
    33. }
    34.  
    35. TableView {
    36. width: mos.width
    37. TableViewColumn {
    38. role: "name"
    39. title: "نام"
    40.  
    41. }
    42. TableViewColumn {
    43. role: "lastname"
    44. title: "فامیلی"
    45.  
    46. }
    47. model: libraryModel
    48.  
    49. style: TableViewStyle {
    50. headerDelegate: Rectangle {
    51. height: 30
    52. border.width: 1
    53.  
    54. color: "lightsteelblue"
    55. Text {
    56. id: textItem
    57. anchors.fill: parent
    58. verticalAlignment: Text.AlignVCenter
    59. //horizontalAlignment: styleData.textAlignment
    60. horizontalAlignment: Text.AlignRight
    61. anchors.rightMargin: 7
    62. text: styleData.value
    63. //elide: Text.ElideRight
    64. //color: textColor
    65. //renderType: Text.NativeRendering
    66. }
    67.  
    68. Rectangle {
    69. anchors.right: parent.right
    70. anchors.top: parent.top
    71. anchors.bottom: parent.bottom
    72. anchors.bottomMargin: 1
    73. anchors.topMargin: 1
    74. width: 1
    75. color: "#ccc"
    76. }
    77. }
    78. }
    79.  
    80. itemDelegate: Item {
    81. Text {
    82. anchors.rightMargin: 7
    83. anchors.right: parent.right
    84. // renderType: Text.NativeRendering
    85. text: styleData.value
    86. }
    87. }
    88. }
    89. }
    90. }//window
    To copy to clipboard, switch view to plain text mode 

    ertefa.png
    rows height of under header.
    height.png

  6. #6
    Join Date
    Oct 2015
    Posts
    46
    Thanks
    19
    Platforms
    Windows

    Default Re: table right to left

    The problem was solved.
    Qt Code:
    1. rowDelegate: Text{
    2. height: 30
    3. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Multiple table delegates or a single table delegate?
    By karankumar1609 in forum Qt Programming
    Replies: 2
    Last Post: 22nd August 2014, 22:28
  2. Replies: 6
    Last Post: 16th April 2013, 17:13
  3. Replies: 7
    Last Post: 26th April 2012, 15:45
  4. Replies: 1
    Last Post: 8th June 2011, 15:13
  5. Replies: 4
    Last Post: 29th August 2010, 19:16

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.