selection

Qt: how to detect whether a widget is selected?

牧云@^-^@ 提交于 2019-12-10 04:35:42
问题 I didn't see any signal/slot/function that could tell me whether a widget is selected by mouse? Is it possible to have such an function to tell me whether the current QWidget is selected? And How could I differentiate between "the current widget is selected" and "one of its child widget is selected?" 回答1: You can check focus on a widget using hasFocus() function. focus property holds whether the widget has keyboard input focus or not. You can also get the current widget of the application

How can I select adjacent rows to an arbitrary row (in sql or postgresql)?

僤鯓⒐⒋嵵緔 提交于 2019-12-10 01:14:20
问题 I want to select some rows based on certain criteria, and then take one entry from that set and the 5 rows before it and after it. Now, I can do this numerically if there is a primary key on the table, (e.g. primary keys that are numerically 5 less than the target row's key and 5 more than the target row's key). So select the row with the primary key of 7 and the nearby rows: select primary_key from table where primary_key > (7-5) order by primary_key limit 11; 2 3 4 5 6 -=7=- 8 9 10 11 12

Listbox datatemplate - item only selectable by clicking a subelement, not just anywhere on the item

不羁岁月 提交于 2019-12-09 16:48:10
问题 I have a listbox with a datatemplate for the items. The problem is that selecting an item doesn't work by just clicking anywhere on the item; I have to click on a specific sub-element for it to actually work. My item has an image and a textblock. If I hover the mouse over the image or text-block, I actually see the hover-effect. If I hover the mouse over any of the 'empty' space of the item, no hover effect (and no selection when I click there). Example image : http://i33.tinypic.com/wvtleg

Replacing text inside textarea without focus

狂风中的少年 提交于 2019-12-09 03:14:03
问题 I want to replace selected text(or insert new text after cursor position if nothing is selected). The new text is entered from another textbox. I want to be able to insert new text without clicking first (focusing) in the textarea. meaning: first select text to replace inside textarea, then enter new text into the textbox and click the button. <textarea id='text' cols="40" rows="20"> </textarea> <div id="opt"> <input id="input" type="text" size="35"> <input type="button" onclick=

RichTextBox selection bug when pressing control key

梦想的初衷 提交于 2019-12-08 19:41:57
问题 I have a very strange bug with text selection in RichTextBox : I create the following simple form : public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { richTextBox1.Text = "Tempore quo primis auspiciis in mundanum fulgorem surgeret victura dum erunt homines Roma, ut augeretur sublimibus incrementis, foedere pacis aeternae Virtus convenit atque Fortuna plerumque dissidentes, quarum si altera defuisset, ad perfectam

javafx - make ListView not selectable via mouse

旧城冷巷雨未停 提交于 2019-12-08 17:34:25
问题 Is there an option in JavaFX to deactivate the possibility to select the items in a ListView via mouse? I'd like to just display a ListView without any user interaction possible. 回答1: You could also try: listview.setMouseTransparent( true ); listView.setFocusTraversable( false ); 回答2: Setting the list to mouse transparent will also prevent cells with interactable custom list cells from accepting focus. The ideal solution is to use a special selection model: import javafx.collections

Save selected text (partial line) from Vim

你。 提交于 2019-12-08 17:25:21
问题 I try to save some selected text (part of a line) from Vim. Here is the line: THIS TEST STRING - SELECTED_TARGET_WORLD where the bold represents the select text. I do this: :'<,'> w! test/selected_text but in the file selected_text I find the string: THIS TEST STRING - SELECTED_TARGET_WORLD How do I make it save only the selected part of the line? 回答1: :[range]w filename only works with lines so… you have to put the selected text on its own line. An alternative using :help :redir : :'<,'>"ay

How to query android calendar events for specific date range?

佐手、 提交于 2019-12-08 16:41:36
问题 I am querying events table in android to get events. String[] projection = new String[] { "calendar_id", "title", "description", "dtstart", "dtend", "eventLocation" }; Cursor cursor = cr.query(Uri.parse("content://com.android.calendar/events"), projection, null, null, null); This returns all the events. But now I want events only in specific duration say 4/03/2013 to 7/03/2013. How do I use selection and selectionArgs[] ? I tried this String selection = "((dtstart <= ?) AND (dtend >= ?))";

jQuery - get selection's paragraph, length, etc

柔情痞子 提交于 2019-12-08 13:35:17
问题 I'm trying to accomplish something I believe should be simple to do in jQuery. I have a long text in my website. Whenever a user selects (highlights) a text, I need to get the following info: The paragraph where the selection begins at The char in that paragraph that the selection starts at The length of the selection The paragraph where the selection ends at (in case the highlight goes beyond one paragraph) The char in that paragraph where the selection ends Thanks ahead ;) 回答1: I think I've

automatic language selection and forwarding to file

坚强是说给别人听的谎言 提交于 2019-12-08 13:22:26
问题 I would like an automatic language selection in my index.php. When the user is from Columbia he is redirected to index_columbia.html and other countries to index_english.html. How can I make this with PHP? 回答1: The language information which is sent by the browser is with server reserved variables. Well, this solution is not based on the location of the visitor but the language setting of the browser which seems better. If doesn't matter if the visitor is from Columbia or France if he is