selection

QT QItemSelectionModel to ignore columns?

别等时光非礼了梦想. 提交于 2019-12-02 08:05:06
I am trying to restrict selection of a tree to a particular column. I am using delegates heavily to create custom per-item-per-column behaviors, editors, etc. I was hoping I could somehow do this from a delegate by blocking an event or something similar. The problem is, I think i would have to create an entirely custom solution that mimics extended selection. However, after a lot of searching and very few examples, it sounds like I want a custom QItemSelectionModel on my tree view. Is this assumption correct? How do I create a custom QItemSelectionModel that will use the Extended Selection

(iPhone) selectedRange for a non-editable UITextView (or other methods of click handling?)

有些话、适合烂在心里 提交于 2019-12-02 07:14:34
问题 I'm using an UITextView to hold static content (in Chinese, which means that the characters are all fixed width). I want to let users click on a character in the text and bring up dictionary information for that character. I know all of the issues surrounding the lack of copy and paste and all that, but I'm hoping that there will be a way to do this without waiting for the iPhone 3.0 firmware. At first, I thought about using UITextView s selectedIndex property. Unfortunately, when the

javascript contentEditable - wrap cross-tag selections

杀马特。学长 韩版系。学妹 提交于 2019-12-02 06:16:26
I'm experimenting a bit with contentEditable and encountered this issue: I have the following js snippet var range = document.getSelection().getRangeAt(0); var newNode = document.createElement("span"); newNode.className = "customStyle"; range.surroundContents(newNode); and this HTML fragment: <ul> <li>the <b>only entry</b> of the list</li> </ul> <p>Some text here in paragraph</p> The js code allows to wrap the current selection with a <span> tag. It works perfectly when the selection includes whole HTML tags (e.g. selecting 'the only entry of') but not, of course, when the selection includes

How to Select particular text in textbox while textbox receives focus

六眼飞鱼酱① 提交于 2019-12-02 05:57:15
问题 I am developing one ASP.NET application with VB code.I have one textbox to hold the amount, which contains default value as "0.00". Now the problem is while the textbox gets focus it selects all the text. But i want to select only 0 that is before precision and I do not want to select after precision. Hope someone will help me. Thanks in advance 回答1: assume you have TextInput you want to select its first character, whenever its selected <input id="MyText" type="text" value="text" onclick=

Listview selection color

孤者浪人 提交于 2019-12-02 05:04:54
问题 I'm playing around with wpf and I saw the following article: WPF ListView Inactive Selection Color I want to do something similar. I want to put a border around an a listviewitem when it is selected and i want to not change the background color. The reason I want this is I want a color coded listview and I still want to see the color when it's selected, but i want to know it's selected by it having a border around it. Any ideas? UPDATE: I tried the below answer and it got me half way, it does

DataGridView, Virtual Mode and “lags”

微笑、不失礼 提交于 2019-12-02 05:00:42
问题 My code looks as follows: private void dataGridView4_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e) { Records recordsTmp = null; recordsTmp = (Records)this.ArrayOfRecords[e.RowIndex]; //ArrayList with string[] objects inside switch (dataGridView4.Columns[e.ColumnIndex].HeaderText) { case "#": e.Value = recordsTmp.nr; break; case "ip": e.Value = recordsTmp.Ip; break; case "long": e.Value = recordsTmp.Long; break; case "3": e.Value = recordsTmp.type; break; case "4": e.Value =

Get Textarea Cursor Position in AngularJs

。_饼干妹妹 提交于 2019-12-02 04:02:21
This question boils down to needing to get the cursor position of a <textarea> element in a directive. In short, all I need to work in this. var position = element.selectionStart; There are at least 5 answers on the subject using various methods, e.g. this one for angular , this one for some jQuery extension , enter link description here . I have read them all and decided to just try to get the selection start object. Here is my PLNKR . I have no idea what I am doing wrong. Note - the background change stuff is to see whether or not I am selecting the right element, which I am. Edit here is a

Prevent JavaScript window.getSelection() circular reference

自闭症网瘾萝莉.ら 提交于 2019-12-02 03:55:53
See this demo (dependent on selectionchange event which works in Chrome only at this moment): http://jsfiddle.net/fyG3H/ Select some lorem ipsum text and then focus the text input. In the console log you will see that there is a DOMSelection object. It has an anchorNode value of HTMLBodyElement while it should have one of Text . I didn't know why this was happening until I tried stringfying the selection object: http://jsfiddle.net/fyG3H/1/ This gives the following error: Uncaught TypeError: Converting circular structure to JSON Do you know how I can prevent this circular reference caused by

How to save select option in localStorage with jQuery?

旧街凉风 提交于 2019-12-02 03:41:05
I am trying to save selected option in localStorage in HTML, so if you refresh page, the selection stays selected. I have try this: HTML: <select id="edit"> <option>1</option> <option>2</option> <option>3</option> </select> jQuery: $(function() { $('#edit').change(function() { localStorage.setItem('todoData', this.innerHTML); }); if(localStorage.getItem('todoData')){ localStorage.getItem('todoData'); } }); But this seems not to work, any ideas, realy thanks for help... Live Demo here: http://jsfiddle.net/nwk1g6vp/ Store and set the value, not the entire HTML of the select $(function() { $('

Observe for highlight?

狂风中的少年 提交于 2019-12-02 03:33:08
Is it possible to use nsISelectionController to watch when a a highlight/selection is made? I know that there are different selection scopes. I want to watch when a user makes a selection in the default scope seen at MXR - nsISelectionController Constants . Kind of like an addEventListener on select change but on the text nodes of the document. Thanks Noitidart I found a solution but it doesn't use nsIController as @Neil had recommended in a SO topic HERE to look at viewSource.js. Im still interested in a nsIController solution if possible, im trying to understand that sucker it confuses me.