GNOME Bugzilla – Bug 770374
Gtk Treeview Editable overshoots column width when column width is small
Last modified: 2016-08-29 07:48:45 UTC
Created attachment 334119 [details] Editable overshooting See attached screen-shot. Steps to reproduce: 1. Run the below program 2. Change column width of any column below 150px 3. Start editing Expected: The editable spans the column width. What happens: The editable exceeds column width. PyGi program ------------ import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk #list of tuples for each software, containing the software name, initial release, and main programming languages used software_list = [("Firefox", 2002, "C++"), ("Eclipse", 2004, "Java" ), ("Pitivi", 2004, "Python"), ("Netbeans", 1996, "Java")] class TreeViewWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="Treeview Filter Demo") self.set_border_width(10) #Setting up the self.grid in which the elements are to be positionned self.box = Gtk.Box() self.add(self.box) #Creating the ListStore model self.software_liststore = Gtk.ListStore(str, int, str) for software_ref in software_list: self.software_liststore.append(list(software_ref)) #Creating the treeview self.treeview = Gtk.TreeView.new_with_model(self.software_liststore) for i, column_title in enumerate(["Software", "Release Year", "Programming Language"]): renderer = Gtk.CellRendererText() renderer.set_property("editable", True) column = Gtk.TreeViewColumn(column_title, renderer, text=i) column.props.resizable = True self.treeview.append_column(column) self.box.add(self.treeview) self.show_all() win = TreeViewWindow() win.connect("delete-event", Gtk.main_quit) win.show_all() Gtk.main()
Created attachment 334128 [details] [review] cell renderer text: Allow entries to shrink Set a small max-width on entries used for editing cells, so they adapt to small columns and don't overlap the next column.
Attachment 334128 [details] pushed as f53706b - cell renderer text: Allow entries to shrink
(In reply to Matthias Clasen from comment #2) > Attachment 334128 [details] pushed as f53706b - cell renderer text: Allow > entries to shrink Thank you for the prompt fix. Is there any specific reason why the width_chars property is set to 5. Why not set it to 1 so that the editable will span the column width for the smallest of columns?